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

link directly to button result

Status
Not open for further replies.

mflancour

MIS
Apr 23, 2002
379
US
I have a link that I can't really provide, but I'll give an example.
This link takes me to a dropdown and a button. in the drop down I pick either "zip" or a "text" then click a button. This then downloads a file of the type I just selected. Stupid question here, but is there any way to create a link that goes directly to one of those files..ie...

Here is a snip form the page source if that would help:

<b>File Type:</b>
<select name="file_type">
<option value="ZIP" selected>

ZIP file (.zip)
</option>
<option value="TEXT">
TEXT/CSV File -- no compression (.csv)
</option>
</select>
<br><br><input type="submit" value="proceed" class="button">
 
More code that is likely relevant:
<form action="affiliate_list.php" method="post" enctype="multipart/form-data">
<input type="hidden" name="merchant_id" value=8550>
<input type="hidden" name="list_id" value=7>
<input type="hidden" name="program_id" value="384" />

<input type="hidden" name="step2" value="true">
<input type="hidden" name="download" value="true">
<div align="justify">
This specific merchant does not require you to upload your list. Merchant agrees to provide you the DNE list. Click on proceed to submit your request for this list.
<br>
<br/><br/>
<b>File Type:</b>
<select name="file_type">
<option value="ZIP" selected>

ZIP file (.zip)
</option>
<option value="TEXT">
TEXT/CSV File -- no compression (.csv)
</option>
</select>
<br><br><input type="submit" value="proceed" class="button">
</form>
 
Hi

Just want to ask the [tt]form[/tt]'s [tt]method[/tt]. Ok, so it is POST.

Is possible that your web application does not sende that file if the request is POST. So you may have to check the code. According to that HTML code, the URL should look like :

affiliate_list.php?merchant_id=8550&list_id=7&program_id=384&step2=true&download=true&file_type=ZIP

Or just use JavaScript to set the option and submit the [tt]form[/tt] :
Code:
<a href="" onclick="document.forms[0].file_type.selectedIndex=0;document.forms[0].submit();return false">download the zip</a>
In the above code I assumed that the [tt]form[/tt] is the first one from the document, because you did not added neither [tt]name[/tt] or [tt]id[/tt] attribute to the [tt]form[/tt].

Feherke.
 
Yes, it's (probably) possible. It depends on whether your affiliate_list.php script can cope with data passed with [tt]method="get"[/tt] instead of [tt]method="post"[/tt]. Hopefully the script will be written that way.

If so, you just need to concoct a url that sends all the stuff that the form sends, to the same action URL that it sends it to. Like this:


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

Part and Inventory Search

Sponsor

Back
Top