Jump to content

Using A Form To Call A Page With Variable Input


jwoker

Recommended Posts

I have the following form which calls a page based on user input and need to add a variable to the url being called. I am unclear how to reference the user input from within the form action.In other words in need to add:

<select><option value="CO">CO</OPTION> <option value="MO">MO</OPTION> <option value="KS">KS</OPTION> <option value="TN">TN</OPTION><option value="OH">OH</OPTION><option value="SD">SD</OPTION> 	  </SELECT>

Into:

<FORM name=Jobs2 	  action="Jobs_list.php?a=advsearch&type=and&asearchfield%5B%5D=state&asearchopt_state=Contains&value_state=CO&value1_state=&asearchfield%5B%5D=customer&asearchopt_customer=Contains 	  method=post><FONT size=1>by cust name  </FONT><INPUT 	  name=value_customer><FONT size=1>  </FONT><INPUT type=submit value=Job></FORM>

Where the ...value_state=CO, which is currently hard coded, becomes the value selected by the drop down selection (CO, MO, KS....).Hope I made sense

Link to comment
Share on other sites

Why hard-code ANY of the query string? It's a form. Any form input that has a name and a value will get appended to the query string automatically. You can use hidden inputs for items you don't want the user to see.I mean, you've chosen a tool that does the work for you. Let it do its work.

Link to comment
Share on other sites

Ok, that leads me to believe i should remove

&value_state=CO

and put this into the form

<select name=value_state ><option value="CO">CO</OPTION> <option value="MO">MO</OPTION> <option value="KS">KS</OPTION> <option value="TN">TN</OPTION><option value="OH">OH</OPTION><option value="SD">SD</OPTION>	  </SELECT>

i'll go give that a shot, thanks

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...