Posted by "zedleon" on 08/04/05 08:31
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>';
?>
[Back to original message]
|