Re: php & forms

From: Date: Mon, 19 May 2003 15:08:12 +0000
Subject: Re: php & forms
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-148170@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 '">&nbsp;&nbsp;&nbsp;'; > echo $lines_list; > echo '<br>'; > } > } > ;?> > > The page that this POSTS to is: > > <?php > ($ignores = $_POST('ignore')) ; $ignores = $_POST['ignore']; Notice the [] instead of ()... ---John Holmes...

« previous php.general (#148170) next »