can't find the parser error
| From: | zedleon | Date: | Thu, 04 Aug 2005 05:31:18 +0000 |
| Subject: | can't find the parser error | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-219973@lists.php.net to get a copy of this message | ||
I am having trouble finding the parser error in this small test script. Any
help would be appreciated
I am pulling in an array from this html form.
<form action="/testarray.php" method="post">
<p>Event Name: <input type="text" name="name" size="30"
/></p>
<p>Week Days</p>
<input type="checkbox" name="weekdays[]" value="Sunday" />S
<input type="checkbox" name="weekdays[]" value="Monday" />M
<input type="checkbox" name="weekdays[]" value="Tuesday" />T
<input type="checkbox" name="weekdays[]" value="Wednesday" />W
<input type="checkbox" name="weekdays[]" value="Thursday" />T
<input type="checkbox" name="weekdays[]" value="Friday" />F
<input type="checkbox" name="weekdays[]" value="Saturday" />S
</P>
<input type="submit" name="submit" value="Add the Event!"
/></form>
testarray.php
<?php
print "<p>You want to add an event called
<b>{$_POST['name']}</b> which takes place on: <br />";
if (is_array ($_POST['weekdays'])) {
foreach ($_POST['weekdays'] as $day) {
print "$day"
}
} else {
print 'Please select at least one weekday for this event!';
}
print '</p>';
?>