hyster Posted March 15, 2011 Share Posted March 15, 2011 i have created a seating system. based on the number of seats booked that value is passed to a page that dynamicly produces a drop down box for each seat booked so the type of seat price can be assigned. this part works fine. the problem i have is how do i code the recieving page not knowing how many values are going to be passed? this is the drop down menu page Thanks <form action="payment.php?seatco=<?php echo $s_count; ?>" method="post" name="f1"> <div id="tick_select"> <?php for($i=1; $i<=$s_count; $i++){ $tick= mysql_query("select * from ticket_list"); ?> <select name="tick_com<?php echo $i; ?>" id="tick_com" onChange="" title="Choose A Ticket"> <option value="">Select Ticket type</option> <?php while($result= mysql_fetch_assoc($tick)) { ?> <?php echo '<option value="'.$result[ticket_id].'" name="'.$result[price].'">'.$result[type].'</option>';?> <?php }}?> </select> </div> <INPUT TYPE="submit" VALUE="Select"> </form> Link to comment https://forums.phpfreaks.com/topic/230737-pasing-dynamic-drop-down-menu-values/ Share on other sites More sharing options...
linus72982 Posted March 15, 2011 Share Posted March 15, 2011 Just add in a counter to your while statement, like this: $i = 1; WHILE STATEMENT { etc $i++;} Then you can pass the value of $i with a hidden form value, like this: <input type="hidden" name="numSelects" value="<?php echo $i; ?>" /> Now, in your program, just pull the value of $_POST['numSelects'] and you have the number of times it iterated. Link to comment https://forums.phpfreaks.com/topic/230737-pasing-dynamic-drop-down-menu-values/#findComment-1187899 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.