Jump to content

pasing dynamic drop down menu value's


hyster

Recommended Posts

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.