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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reloading the page and including the variables into the Url

Status
Not open for further replies.

Jimuniguy

Technical User
Mar 6, 2002
363
GB
Hi,

What do i need to do in order to have an ASP page, where a form is selected and when the user presses "submit" the page will reload with the url containing the variables that they just chose?

e.g here is the code for the form, now i just want to be able to reload the page containg the form and in the url have the variable that I just choose.
Code:
<FORM ACTION=&quot;???&quot; METHOD=GET>
<Option NAME=&quot;HolidayLocation&quot;>
<table width=&quot;60%&quot; border=&quot;1&quot;>
  <tr>
    <td><OPTION>Madrid</OPTION></td>
    <td><OPTION>Rome</OPTION></td>
    <td><OPTION>Paris</OPTION></td>
    <td><OPTION>Berlin</OPTION></td>
    <td><OPTION>Moscow</OPTION></td>
    <td><OPTION>Birmingham</OPTION></td>
  </tr>
</table>  
</SELECT>
<INPUT TYPE=&quot;SUBMIT&quot;>

How is it done though?

Cheers

James
 
JamesUniqueGuy

Your variables are recieved in your ACTION asp page. Your code is also incorrect for a dropdown box.

<FORM name=&quot;myform&quot; ACTION=&quot;My_Variables.asp&quot; METHOD=&quot;GET&quot;>
<select NAME=&quot;HolidayLocation&quot;>
<OPTION>Madrid</OPTION>
<OPTION>Rome</OPTION>
<OPTION>Paris</OPTION>
<OPTION>Berlin</OPTION>
<OPTION>Moscow</OPTION>
<OPTION>Birmingham</OPTION>
</select>



--- My_Variables.asp
<html>
<body>
<%
strInput = request.querystring(&quot;HolidayLocation&quot;)
response.write &quot;Input is: &quot; & strInput

%>
</body>
</html>


fengshui_1998
 
Just as a followup on the post that FengShui made. The action line of a form is only required if you are posting the information to a second page. If you are posting the information from the form back to the same page (as you said you are) You can leave the entire action piece out of the form object.

<FORM name=&quot;myform&quot; METHOD=&quot;GET&quot;>
<select NAME=&quot;HolidayLocation&quot;>
<OPTION>Madrid</OPTION>
<OPTION>Rome</OPTION>
<OPTION>Paris</OPTION>
<OPTION>Berlin</OPTION>
<OPTION>Moscow</OPTION>
<OPTION>Birmingham</OPTION>
</select>

Will give you the same thing. But now it doesn't matter if you rename the page that the form object is in, it will always refer back to itself.
The money's gone, the brain is shot.....but the liquor we still got.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top