|
Posted by Philb on 03/05/07 10:57
Can someone lend a hand with this please, i've been on it for ages and
still can't figure out where I'm going wrong.
I have a simple form with 4 checkboxes, I want to post the info from the
checkboxes and have it displayed on the next page.
Html Form to let a person pick their favourite t-shirt color....
e.g.
Select your favourite T-shirt color.
Red
White
Blue
Yellow
<form method="post" action="colorsubmit.php">
<p>Select your favorite T-shirt color.</p>
<input type="checkbox" name="tcolor[red]" value="Red">Red<br />
<input type="checkbox" name="tcolor[white]" value="White">White<br />
<input type="checkbox" name="tcolor[blue]" value="Blue">Blue<br />
<input type="checkbox" name="tcolor[yellow]" value="Yellow">Yellow<br />
<input type="submit" value="submit">
</form>
The PHP on the next page looks like this 'colorsubmit.php'
<?php
$tcolor[red]=$_POST['tcolor[red]'];
$tcolor[white]=$_POST['$tcolor[white]'];
$tcolor[blue]=$_POST['$tcolor[blue]'];
$tcolor[yellow]=$_POST['$tcolor[yellow]'];
?>
You chose
<?php
echo $tcolor[red], $tcolor[white], $tcolor[blue], $tcolor[yellow]
?>
I know the echo statement works but the POST section is wrong, can
someone help me a PHP beginner?
Phil
[Back to original message]
|