Okay, so I downloaded the contact form php script and copied the parameters. I have it working, but now I want to modify it, and Im not sure how to go about it. Basically what I want to do is create a form that the user has to fill out (and won’t submit without validating), and then the submit button performs two functions. It will download a zip file onto their hard drive as well as redirect them to a different page (or back to the index page, Im not picky). I can make the page redirect to another, or download the file. But once it downloads the file, it is sitting on an empty page, if I just point the redirect straight to the zip file. So how can I make it perform both functions? Any help would be greatly appreciated. Thanks in advance!
This reply has been reported for inappropriate content.
when asking code questions, you should always post your code. a lot of times it might be a simple matter of making one little change to your code. Without seeing your code, No no one can make that change. Most people won’t want to sit here and right out the entire program.
I would think all you would need to do is throw in an elseif statement.
once validated, have the script do the download and re-direct to the page you want.
something like this:
JS part— bear in mind it will never work, but the logcal part of it
validate the form
if (all_form_validated == true)
re-direct to new page;
. Obviously the PHP is only the latter half of the code, but my main problem is just knowing what to add to the code to make it do the download. Im not completely familiar with PHP as a coding language, so Im not sure how to make it do both. Im assuming it requires writing one more piece in the if ($success) section, but I don’t know what.
when you call the mail script it runs, so if you call another script before the mail script (the whole file not just te mail function) that file will run, when the new script completes its job, the mail script will resume.
so yes it is possible, you just need to look inot the file handlers of PHP, or search for a php download file script. or why dont you email them the file???
Im looking into file download scripts as per your suggestion. I want the e-mail to go to my client, but the file to be downloaded by the customers on his page. Basically, the information the customers fill out will be in the e-mail, and they must submit it in order to download the file. I can try to mash up the two scripts together, but I just wasn’t sure how to successfully put both together. Perhaps when I get to that point, I’ll post it here and see what else needs to happen.
You must be logged in to reply to this topic.