how to make Submit form with download link
Page 1 of 1
how to make Submit form with download link
Hi,How to make submit form, that links to download a file. I mean after entering or submitting data in the form than go to download file link.
Re: how to make Submit form with download link
Hi nepalitheto, it is invariably a tricky thing to do when it comes to using data entry forms to redirect a user to a download page. What you'd do is to declare an 'if, var' javascript function telling the page to redirect to the download link only when the fields in the form are completed in an event where the ok or send button is clicked. Place the code handler on the button. You could choose to do an auto download after that button is clicked by creating an iframe and making its display source the file to be downloaded e.g <iframe src="download file.exe"></iframe>. If u still got problems, state them specifically.Re: how to make Submit form with download link
Simply in form action attribute put the download link orin form action attribute just put the php file path and in php file check if user submit something then redirect them to download file path.
i.e
- Code: Select all
<form action="thefile.php" method="post">
First Name:<input type="text" name="firstname" />
<br />
</form>
and thefile.php would look like this
- Code: Select all
<?php
if(isset($_POST["firstname"]){
//code to save data in database
//and after that redirect user to original download link
header('Location: http://www.example.com/downloadlink');
}
?>
hope this will give you an idea how to do this its simple.
regards,
Xain Pro
Re: how to make Submit form with download link
Hi,Thank you for your inform.
I have created the form and where should I put the above code.
- Code: Select all
<!---Begin form display-->
<form enctype="multipart/form-data" method="post" action="pgm-form_submit.php">
<style title="userform-inline_css">
/* Generated CSS theme for user-created form */
/* Hack to fix border on floated elements in IE */
.ie_cleardiv {
display: block;
clear: both;
float: none;
margin: 0;
/*border: 1px dotted red;*/
}
.field-container {
display: block;
clear: both;
margin-bottom: 6px;
vertical-align: top;
font-family: Trebuchet MS, arial, helvetica, sans-serif;
/*border: 1px solid red;*/
}
.asterisk {
color: red;
}
.instructions {
margin-top: 0;
color: #2e2e2e;
font-family: Trebuchet MS, arial, helvetica, sans-serif;
font-size: 12px;
line-height: 1.1em !important;
}
.myform-field_title-top,
.myform-field_title-left {
font-size: 11px;
font-weight: normal;
font-family: Trebuchet MS, arial, helvetica, sans-serif;
margin-bottom: 0;
color: #595959;
border-width: 1px;
border-color: #ccc;
border-style: hidden;
}
.myform-field_title-left {
display: block;
float: left;
margin-right: 15px;
/*margin-top: 12px;*/
margin-top: 2px;
text-align: left;
/*border: 1px solid red;*/
}
.myform-field_title-hidden {
display: none;
}
.myform-input_container, .myform-formfield_container {
display: block;
float: left;
margin-top: 0;
font-size: 11px;
}
#form_body_container h1,
#form_body_container h2,
#form_body_container h3,
#form_body_container h4,
#form_body_container h5,
#form_body_container h6 {
font-family: Trebuchet MS, arial, helvetica, sans-serif;
margin-bottom: 0;
}
</style>
<!---Begin form display-->
<div id="form_body_container" style="text-align: left;background-color: transparent;margin: 10;padding: 0px;width: 210;border-style: none;border-width: 0;border-color: #000;">
<div class="field-container">
<h1 style="color: #595959;">Itinerary Reuest</h1>
<p class="instructions" style="color: #595959;">Please input relevant information to access the itinerary.u</p>
<div class="ie_cleardiv">
</div>
</div>
<div class="field-container">
<p class="myform-field_title-top" style="width: 75px;">First Name<span class="asterisk">*</span>
</p>
<p class="myform-input_container"><input type="text" name="First_Name" style="width: 200px;"/></p>
<div class="ie_cleardiv">
</div>
</div>
<div class="field-container">
<p class="myform-field_title-top" style="width: 75px;">Last Name<span class="asterisk">*</span>
</p>
<p class="myform-input_container"><input type="text" name="Last_Name" style="width: 200px;"/></p>
<div class="ie_cleardiv">
</div>
</div>
<div class="field-container">
<p class="myform-field_title-top" style="width: 75px;">Email Address<span class="asterisk">*</span>
</p>
<p class="myform-input_container"><input type="text" name="emailaddr" style="width: 200px;"/></p>
<div class="ie_cleardiv">
</div>
</div>
<input type="hidden" name="required_fields" value="First_Name;Last_Name;emailaddr;"/>
<div id="userform-submit_btn-container" style="text-align: center;">
<input id="userform-submit_btn" type="submit" value="Submit >>" style="font-size: 13px;font-weight: normal;">
</div>
</form>
</div>
Re: how to make Submit form with download link
in this filepgm-form_submit.php
Re: how to make Submit form with download link
I put your code in above file ?I am trying to have a form in different pages. But when submitter click on button in different location will download different file.
Re: how to make Submit form with download link
you should add a field in the form and dynamically write its value of file name and in next page check that value and dynamically give option to download file for every page.Re: how to make Submit form with download link
Thank you for your mail. I am not sure where exactly and what code has to be placed. In the submit button or some where else.Re: how to make Submit form with download link
You need some study please do study php tutorials and then try again :)Page 1 of 1