|
Posted by Geoff Berrow on 03/05/07 11:10
Message-ID: <SISGh.12997$I46.1575@text.news.blueyonder.co.uk> from Philb
contained the following:
>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>
No, do this.
<input type="checkbox" name="tcolor[]" value="Red">Red<br />
<input type="checkbox" name="tcolor[]" value="White">White<br />
<input type="checkbox" name="tcolor[]" value="Blue">Blue<br />
<input type="checkbox" name="tcolor[]" value="Yellow">Yellow<br />
>
>
>
>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?
<?php
$colours=implode(",",$_POST['tcolor']);
?>
You chose :- <?php echo $colours; >?>.
--
Geoff Berrow 0110001001101100010000000110
001101101011011001000110111101100111001011
100110001101101111001011100111010101101011
[Back to original message]
|