You are here: Using Post with Multiple Checkboxes ? « All PHP « IT news, forums, messages
Using Post with Multiple Checkboxes ?

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация