View Full Version : Form field values passed through custom hyperlink

08-29-2007, 10:39 PM
This is probably total beginner question. Please bear with me.

I have a form on the page in this format:

<form><table width="100%" border="0" cellpadding="0" cellspacing="0">
<td width="2%">&nbsp;</td>
<td width="31%"><img src="images/spacer.gif" width="1" height="20" alt="" /></td>
<td width="67%">&nbsp;</td>
<td><span class="top_nav_link">Arrival Date:</span>
<input type="text" value="<?php echo date("m/d/Y") ?>" onfocus="this.select();lcs(this)" onclick="event.cancelBubble=true;this.select();lcs(this)" name="arr" class="calendarEntry" size="10" /></td>
<td><span class="top_nav_link">Rooms:</span>
<select class="nightsEntry" name="rms">
<option value="1" selected="selected">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select> </td>
<td><img src="images/spacer.gif" width="1" height="17" alt="" /><span class="top_nav_link">Departure Date:</span><input type="text" value="<?php echo date("m/d/Y",strtotime("+24 hours")) ?>" onfocus="this.select();lcs(this)" onclick="event.cancelBubble=true;this.select();lcs(this)" name="dep" class="calendarEntry" size="10" /></td>
<td><img src="images/spacer.gif" width="1" height="15" alt="" /><br /><input type="image" src="images/rates.gif" alt="Check rates" width="97" height="20" value="Submit" name="submitform" /></td>

When form is submited I need three values (arr,dep and rms) to be send in the link like this (example):


Form on the destination page accepts variables in this format. Typing link in the browser like that works.

How would I do this? I tried many different paths and I had to scrap all of them. I tried setting the link as action for the form, tried posting form to itself and then pulling variables, I hit a wall each time.

Please if anyone can point me in the right direction I would appreciate it.


08-30-2007, 12:43 AM
I'm not quite sure what you're asking, but the only way you can pass form values is via a submit input on a form with the action and method values set appropriately (in your case, the name of your PHP processing script and "get" respectively).

08-30-2007, 12:47 AM
In case you still don't get it:

<form name="form1" action="nextpage.php" method="get">

Substitute nextpage.php with the actual file you want to send the form data to.