Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

basic form question

Status
Not open for further replies.

tonyx666

MIS
Apr 13, 2006
214
GB
http://www.airporttaxilondon.com

ok this site uses a booking form in stages. its php but im sure it can be done with asp.

you find a quote from their database.. that is simple enough.. then it shows the user what quote they have and they book it.. again, simple enough..

however, the actual form to book the journey is in 2 parts..

the first form allows the user to enter their contact details..

they then click a continue reservation button..

then they enter the job details.. and click confirm booking..


so basically my question is this.. as far as i was concerned you placed all your form elements on one page.. and when they click the send button the details are emailed to you..

i just want to know how they can split the form into 2 pages like this.. do they temporarily store the booking details from the first page somewhere.. and then send them all

or do they send the customer details to the booking page.. and then have them on the 2nd form as hidden.. and then send them all??

do you lot know what im saying?

London Heathrow Cars
 
Personally, i would store it in a DB. Enter the info from the both pages, when they hit the Submit on the second page, pull the info out and email it. This way if you evey have any issues with an email you always have the info stored in the DB.

If you don't want to do that, then on the second page you can have hidden text boxes that request all the info from the first page. Somthing like this (in ASP since i don't know PHP)

Code:
<input type="hidden" name="Name" value="<%request.form("name"%>">
<input type="hidden" name="Address" value="<%request.form("addy"%>">
 
The PHP version would probably be something like:
Code:
foreach($REQUEST as $key=>$value){
   print "<input type=\"hidden\" name=\"$key\" value=\"$value\">";
}

Basically just a loop through all of the fields form the previous page to dump them into hidden fields. It's also possible that they hardcoded every single one, which in my mind is kind of a waste, but you never know. Warning, my PHP skills are a little flaky sometimes, so that may not quite be syntactically correct.

The same process can be used in ASP to generate the hidden fields on the fly. Basically you would ForEach key in Request.Form and then create the input using your key variable (name of the input) and Request.Form(key) (value of the input).


I think that generally I would use the database method also, but unless I was offering some capability to resume the process at a later point, i wouldn 't save any data into the database submission of the second form.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top