im developing a system where a user can select what flower goes into their bouquet, and ive become a little bit stuck... heres what ive done to date:
currently ive got a page displaying a tables records (the flowers) the page has a checkbox next to each record where the record primary key has been assigned to the checkbox.
once the user select the items and clicks sumbit it takes them to a 'choice' page to display the flowers they have chosen. ive tried both the get and post functions and found that the get function displays all the keys in the url but when i try to read out the urls it only displays the last one, confused? ok
so ive selcted items 3 and 4 in the list and select submit... in the url it shows: choice.php?flowerid=3&flowerid=4.
but when i try to call these on the screen... records 3 and 4 it will only show record for...
so heres the code im using for the submit page and action page:
-------------------------submit page------------------------------------
Expand|Select|Wrap|Line Numbers
- <?PHP
- $qry = mysql_query ('SELECT * FROM flowers');
- $result = mysql_fetch_array($qry);
- ?>
- <body>
- <form name="choice" action="choice.php" method="GET">
- <?PHP
- while ($row = mysql_fetch_array($qry)){
- echo $row['flowername']; ?>
- <input type="checkbox" value="<?php echo $row['flowerid']; ?>" name='flowerid'>
- <?PHP
- }
- ?>
- <input type="submit" value="submit" />
- </form>
-------------------action page------------------------------------
Expand|Select|Wrap|Line Numbers
- <?php
- include "constants/flowertimedbcnx.php";
- $r = @$_GET['flowerid']; //users choice..
- $s = @$_GET['flowername'];
- ?>
- <?php
- echo "You have chosen to buy flowers for your
- <b>$r, $s</b>.";
- ?>
if you need anymore information to help please let me know...
ive also tried replacing the 'GET' with 'POST' but it still on displays the last record passed., but using 'GET' it showed that the 2 record ids were being passed.
many thanks in advance!