passing data in a form
| From: | mailing | Date: | Sun, 20 Apr 2003 11:30:49 +0000 |
| Subject: | passing data in a form | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-144529@lists.php.net to get a copy of this message | ||
Can someone explain this to me. In newbie terms please - so that I understand it rather than just
paste it in. Thanks
This is my code:
<snip>
$sql ="SELECT DISTINCT zone FROM targetlist where valid_user = '$valid_user'
";
$result = @mysql_query($sql) or die(mysql_error());
$num = @mysql_num_rows($result);
while ($row =mysql_fetch_array($result)){
$zone = $row['zone'];
$display_block .="<input type='checkbox' name=\"zone_selected\"
value=\"$zone\">$zone<br>";
}
<end snip>
This displays the zones that I have available as checkboxes in my form.
If I select one checkbox all works as expected
using :
$zone_selected = $_POST[zone_selected];
However, if I select 2 or more checkboxes, I only get the results of the last option selected.
How can I add a "while there is data in $zone_selected repeat them on the page...." sort
of thing.
Many thanks fr any help
Jim