php & forms
| From: | Matthew Boeckman | Date: | Mon, 19 May 2003 14:46:14 +0000 |
| Subject: | php & forms | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-148167@lists.php.net to get a copy of this message | ||
Hello list. I'm a newb (of course!) and am struggling getting multiple selections in a form to work. I'm populating the form data dynamically from an array, which is read from a file. I then need to let the user select things, and have those selections passed back as variables. I have tried various things in the docs, all without success. Here is what I have now:
This is the page that reads the file, and displays the options, this page works fine. Please don't be too harsh of what is almost certainly crapulent syntax, but I'd appreciate cleaner ways to do it:
$list=file('current.sync');
foreach ( $list as $lines_list ) {
if (preg_match ("/\b.jsp\b/", $lines_list)) {
echo '<font color="#FF0000"><input type="checkbox" CHECKED name="ignore[
]" Value="';
echo $lines_list;
echo '">';
echo $lines_list;
echo '</font> <br>';
} else {
echo '<input type="checkbox" name="ignore[]" value="';
echo $lines_list;
echo '"> ';
echo $lines_list;
echo '<br>';
}
}
;?>
The page that this POSTS to is:
<?php
($ignores = $_POST('ignore')) ;
foreach ( $ignores as $ignore_list ) {
echo $ignore_list;} ;?> You can see that I am trying to give the user an opportunity to see what they have selected. I am getting the following error on this: Fatal error: Call to undefined function: array() in move-live.php on line 5 Any suggestions or thoughts would be much appreciated! I've tried several different things, all to no avail. -matthew -- Matthew Boeckman Manager - Systems Integration Saepio Technologies