Carrying Values to Next Page

liunx

Guest
Hello...<br />
<br />
I would like to know if it is possible to click on a link that says, Reserve This Room... which happens to be room # 1... and have it carry over info to a reservation form on the next page... and in the text box that asks what room number you want to reserve, it will automatically insert the value 1. Can you do this with HTML?? or is there another way?<br />
<br />
Thanks Kim<!--content-->no you cannot do it with just html. you need to use serverside langauge for this. like php, asp or cgi.<br />
<br />
<br />
pick the best one your host supports and go to work. if you don't know any of it there are hundreds of tutorials on the web that can help you out.<!--content-->If all you want to do is pass the room number just make it an argument on the link like this:<br />
<br />
<a href=http://www.htmlforums.com/archive/index.php/"reservation.cgi?roomNumber=1"> reserve room 1</a><br />
<a href=http://www.htmlforums.com/archive/index.php/"reservation.cgi?roomNumber=2"> reserve room 2</a><br />
<br />
etc...<br />
<br />
Then in the head of the form page put this script:<br />
<script language="JavaScript"><br />
<!--<br />
var valarr = new Array;<br />
function populateRoom()<br />
{<br />
x=location.search.substring(1);<br />
valarr=x.split('=');<br />
document.forms[0].roomNumber.value=valarr[1];<br />
}<br />
//--><br />
</script><br />
<br />
The function gets fired from the body tag with:<br />
<br />
<body onLoad="populateRoom()"><br />
<br />
<br />
If the room number is in a variable, you are better to do the link this way:<br />
<br />
<a href=http://www.htmlforums.com/archive/index.php/"#" <br />
onClick="url='reservation.cgi?roomNumber='+roomvar;location.href=http://www.htmlforums.com/archive/index.php/url;return false;"><!--content-->i tried what you said and this is the message that i got??<br />
<br />
i want it to go to page reservations.html... so i'm not sure i understand the reservations.cgi part.... <br />
<br />
Forbidden<br />
You don't have permission to access /reservation.cgi on this server.<!--content-->just make cgi html.<!--content-->http://www.westwindsinn.com/Room1.html<br />
<br />
<br />
HI! The value 1 didn't carry over into the reservations page!<br />
<br />
<br />
<br />
<TR VALIGN="top" ALIGN="left"><br />
<TD WIDTH=77 valign="middle"><br />
<P ALIGN="left">Room #</TD><br />
<TD colspan="3"><br />
<P><br />
<INPUT id="RoomNumber" TYPE="text" NAME="RoomNumber" VALUE="Room" SIZE=12 MAXLENGTH=30 > <a href=http://www.htmlforums.com/archive/index.php/"roomsrates.html">Rooms</a> </TD><br />
</TR><!--content-->Hi! THANK YOU FOR YOUR HELP!!! IT WORKS!!! :-)<!--content-->
 
Back
Top