Jump to content

Help with my form - passing array to another php script


chrisneedham

Recommended Posts

I have been setting up a shopping basket and am having difficulties with the php scripting of one of the forms.

Basically I have a shop site that people can book on a specific event/s - once they book one or more events the form request them to enter the name of the person attending each event.

What i am struggling with is passing the inputed information on to another php page (i.e. preview page).

snippet of the script for the form is:

 

<form action="<?php echo $_SERVER['PHP_SELF'];?>?step=2" method="post" name="frmCheckout" id="frmCheckout" onSubmit="return checkShippingAndPaymentInfo();"> 
<div align="left"> 
<blockquote> 
<?php 
$cartContent = getCartContent(); 
$numItem = count($cartContent); 
$subTotal = 0; 
for ($i = 0; $i < $numItem; $i++) { 
extract($cartContent[$i]); 
$subTotal += $pd_price * $ct_qty; 
?> 
<table width="607" border="0" cellpadding="5" cellspacing="1" class="entryTable"> 
<tr class="entryTableHeader"> 
<td colspan="2"> 
<span style="font-weight: 700"> 
<font face="Verdana" style="font-size: 9pt" color="#006600"> 
<?php echo $pd_code;?> - <?php echo $pd_coursedate;?> - Delegate Details</font></span><font face="Verdana" style="font-size: 9pt; font-weight: 700" color="#006600"></font></td> 
</tr> 
<?php 
for ($h = 0; $h < $ct_qty; $h++) 
{ 
?> 
<tr> 
<td class="content" width="227"><font face="Verdana"> 
<span style="font-size: 9pt"> 
Delegate Name<br> 
<input name="delname[]" type="text" class="box" id="delname" size="31" maxlength="50" style="border: 1px solid #006600"></span></font></td> 
<input name="hidprodid" type="hidden" id="hidprodid" value="<?php echo $pd_id;?>"> 
</td> 
<td class="content" width="171"><font face="Verdana"> 
<span style="font-size: 9pt"> 
Delegate Date of Birth<br> 
<input name="deldob[]" type="text" class="box" id="deldob" size="22" maxlength="50" style="border: 1px solid #006600"></span></font></td> 
</td> 
<td class="content" width="176"> 
<font face="Verdana" style="font-size: 8pt">Previously 
attended a City & Guilds course with OTT?<br> 
<select size="1" name="delbefore[]" style="border: 1px solid #006600"> 
<option>No</option> 
<option>Yes</option> 
</select></font></td> 
</tr> 

<?php 
} 
?> 
</table> 
<?php 
} 
?> 

 

This code has a for loop which looks for how many events have been booked and displays each detail. Within this for loop is a nested for loop which then looks for how many places have been booked on the event and displays a text input box for each place on each course.

 

So what i need to do on the preview page is show the event the person has booked and show the name of the person attending the specific event. For example if someone has booked 3 events with 2 people attending each event - it should have:

 

Event Name: 1

Name of attendee: Bob

Name of attendee: Fred

 

Event Name: 2

Name of attendee: Chris

Name of attendee: John

 

etc etc

 

Anyone have a simple way of doing this - sorry if this doesn't make much sense but I am a beginner when it comes to php etc

 

Thanks in advance

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.