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

Form Values in a link

Status
Not open for further replies.

bill1one

Programmer
Sep 29, 2004
93
US
I have a form that looks like this:
<FORM ACTION="../TLCScripts/interpac.dll?NewestSearch" METHOD="post">
<INPUT TYPE=hidden NAME=Config VALUE="PAC">
<INPUT Type="hidden" Name="SearchField" Value="17">
<INPUT Type="hidden" NAME="PeriodLimit" Value="30">
<INPUT type="hidden" name="SearchType" value="1">
<INPUT type="hidden" name="SortField" value="2">
<INPUT type="hidden" name="ItemsPerPage" value="100">
<b>New Items</b><br />
<SELECT name="SearchData">
<OPTION value="sound recording-CD">Audio Books</OPTION>
<OPTION value="Videorecording-DVD">Movies</OPTION>
</SELECT>
<INPUT type=submit value="Submit">
</FORM>

What I'd like to do is eliminate the form and just have two links, one that says "Movies" and another that says "Audios".
How can I create a simple link that incorporates all the input values in the form?

Thanks.
 
This example shows how you can change the submit button to do this. Basically you click one submit button or the other. You can then pick up on the value of the submit button server-side to determine which one was clicked...
Code:
<FORM ACTION="../TLCScripts/interpac.dll?NewestSearch" METHOD="post">
	<INPUT TYPE=hidden NAME=Config VALUE="PAC">
	<INPUT Type="hidden" Name="SearchField" Value="17">
	<INPUT Type="hidden" NAME="PeriodLimit" Value="30">
	<INPUT type="hidden" name="SearchType" value="1">
	<INPUT type="hidden" name="SortField" value="2">    
	<INPUT type="hidden" name="ItemsPerPage" value="100">
	<b>New Items</b><br />
	[b]<input type="submit" name="SearchData" value="Audio Books"/>
	<input type="submit" name="SearchData" value="Movies"/>[/b]
</FORM>
This solution preserves the method of the form and doesn't require any javascript.

Cheers,
Jeff

[tt]Jeff's Page [/tt][tt]@[/tt][tt] Code Couch
[/tt]
 
So it looks like if I wanted to make this a simple URL link, that I'd have to use some sort of javascript to do so. Is this a correct conclusion?
 
Are you sure about that [tt]?NewestSearch[/tt] in the action URL? Looks odd.

Oh well, try this:
Code:
<a href="../TLCScripts/interpac.dll?NewestSearch&amp;Config=PAC&amp;SearchField=17&amp;PeriodLimit=30&amp;SearchType=1&amp;SortField=2&amp;ItemsPerPage=100&amp;SearchData=sound%20recording-CD">Audio Books</a>
<a href="../TLCScripts/interpac.dll?NewestSearch&amp;Config=PAC&amp;SearchField=17&amp;PeriodLimit=30&amp;SearchType=1&amp;SortField=2&amp;ItemsPerPage=100&amp;SearchData=Videorecording-DVD">Movies</a>

As a short cut, change your existing form to be [tt]METHOD="get"[/tt], use it to display the screens you want, and cut & paste the URLs that you get in the address bar.


-- Chris Hunt
Webmaster & Tragedian
Extra Connections Ltd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top