PDA

View Full Version : need a little help with this



SmackDragon
12-22-2004, 10:07 PM
Script: "Accept terms" form submission
http://www.dynamicdrive.com/dynamicindex16/acceptterm.htm

i need to know if and how this script could be edited to download a file on clicking the button instead of submitting the form, thanks for help in advance.

ddadmin
12-29-2004, 01:19 AM
Well, there's two ways. You can either modify your form cgi/php script to invoke a download, or I suspect you're looking for an easier way, which is simply to use JavaScript instead. Try modifying the code:

if (window.checkobj&&checkobj.checked)
return true

inside Code of Step 1 to:

if (window.checkobj&&checkobj.checked){
window.location="http://www.mysite.com/what.zip"
return false
}

where "http://www.mysite.com/what.zip" is the path to your file to download. This only works if the file type (ie: zip) triggers a file download in the browser instead of simply loading it, such as a .gif.