well u have a parse error in ur TESTARRAY.PHP file
within the foreach loop
u hav writen
print "$day"
while here u must also terminate it through semi-colon like this
print "$day";
This wil solve the problem
Now it wil work
zedleon wrote:
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>';
?>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php