PDA

View Full Version : Form submit botton


Jittor
12-05-2005, 08:41 PM
Hi Everyone,

I have created a basic form in DW. I would like the submit button to preform 2 actions. First email the info provided in the fields and second rediret to another page or possibly a PDF file for them to download. I am not sure exactly how to do this so any advice would be helpful. Will post code if needed. Thanks,

ramandeep
12-05-2005, 08:49 PM
Hi,
First of all sending form results to email you can use PHP,ASP based script depending upon the your host support.

Secondly redirecting it is very easy!

If you have PHP support you can go to this thread
http://www.dreamweaverclub.com/forum/index...?showtopic=1519 ('http://www.dreamweaverclub.com/forum/index.php?showtopic=1519')

The PHP script given is answer to both your questions,you will just have to change the parameters.

Jittor
12-05-2005, 09:20 PM
I dont know that much about php. I have set the form up in Dreamweaver and the form action was set to mailto:email@email.com how do I set it up to go through the php page?

ramandeep
12-05-2005, 09:34 PM
First save that sendresults.php file in the same folder as your form.Open the php file and edit the following fields

$subject --------subject of the email which delivers you the form results
$emailadd ------email address where you want to deliver the form results
$url--------------URL where you want the page to redirect after form submission(this will be you PDF file URL )

Then open the form page in actions write sendresults.php and Method=Post

Test it it should work!

Jittor
12-05-2005, 09:35 PM
I set the

<form action="sendresults.php" method="post" enctype="text/plain" name="Advertising" id="Advertising">

and put the sendresults.php up on the server but it just tries to download the fle when you click submit. Did I do something wrong?

Jittor
12-05-2005, 09:38 PM
when I test it in DW (F12) it does the same thing - trys to download the file. I did everything you stated above.

ramandeep
12-05-2005, 10:03 PM
You are doing right!
You need to have testing environment configured on your PC before viewing it by pressing F12.Anyway upload the files to your host,it will work!

Jittor
12-05-2005, 10:10 PM
Ok, I uploades everything and when I hit submit I get the lovely error page can not be displayed. I don't understand that when I uploaded it onto the server. I even hopped onto my ftp to double check that it was there. Here is the web address maybe I missed something.

http://www.petsincredible.com/coupon_signup.asp ('http://www.petsincredible.com/coupon_signup.asp')

If I can get this to work it will be great. PHP seems like a great language to know. How does it compare to others. thanks

ramandeep
12-05-2005, 10:20 PM
:o you are using ASP!Mate you need to do it with an ASP script.
You din tell me you are using ASP.

Anyways wll get a solution with ASP !

Jittor
12-05-2005, 10:24 PM
:unsure: Sorry, I wasn't thinking. I am really only using it for the header and footer - the backend that we use for a shopping cart is mainly all ASP. I am not a big fan of ASP. But had no choise.

Jittor
12-06-2005, 08:35 PM
I tried it using just HTML and no ASP for the your sendresults.php file and everything worked great but there was no data sent to my email. It just had the subject line and nothing else. Any idea why?

dreamlynx
12-06-2005, 08:39 PM
dude post the code. I will help you fix it

by the way the answer to your question is god

Jittor
12-06-2005, 08:47 PM
Here is the code - I took out most of the states to save on space. - Very good on the answer no one else has ever answered it. Thanks for the help!


<BODY LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0>
<table width="775" border="0" align="center">
<tr>
<td>pets_graphics/coupon_text.gif<font size="5" face="Arial, Helvetica, sans-serif">
- $300 in savings for new pet adopters!</font> </td>
</tr>
<tr>
<td><div align="center"><font size="3" face="Arial, Helvetica, sans-serif">Please
fill in the information below, click submit and you'll be directed to
the coupon page.</font></div></td>
</tr>
<tr>
<td><div align="center">
<form action="http://www.fmntv.com/sendresults.php" method="post" enctype="text/plain" name="Advertising" id="Advertising">
<table width="97%" border="2" align="center" cellspacing="1" bordercolor="#FFFFCC">
<tr>
<td bgcolor="#FFFFCC"> <fieldset>
<legend><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Contact
Information - Parts marked <font color="#FF0000">*</font> must
be filled out in order to Submit Form!</font></legend>
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="5">
<tr>
<td width="17%"><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Contact
Name<font color="#FF0000">*</font></font> </div></td>
<td width="37%"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<input name="Contact Name" type="text" id="Contact Name" size="25" maxlength="50">
</font></td>
<td width="17%"><div align="right">Number of Dogs:</div></td>
<td width="29%"><input type="text" name="textfield" id="textfield"></td>
</tr>
<tr>
<td><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Address<font color="#FF0000">*</font></font></div></td>
<td><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<input name="Address" type="text" id="Address3" size="30" maxlength="70">
</font></td>
<td><div align="right">
<label for="label2">Name of Dogs:</label>
</div>
<div align="right"></div>
<div align="right"></div></td>
<td><input type="text" name="textfield2" id="textfield2"></td>
</tr>
<tr>
<td><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">City<font color="#FF0000">*</font>
</font></div></td>
<td><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<input name="City" type="text" id="City3" size="25" maxlength="50">
</font></td>
<td colspan="2"></td>
</tr>
<tr>
<td><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">State<font color="#FF0000">*</font></font></div></td>
<td><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<select name="select" id="select6">
<option value="AK">ALASKA </option>
<option value="AL">ALABAMA</option>
<option value="AR">ARKANSAS</option>
<option value="AZ">ARIZONA </option>
<option value="CA">CALIFORNIA </option>
<option value="Please Select" selected>-- Please Select
--</option>
</select>
</font></td>
<td colspan="2"></td>
</tr>
<tr>
<td><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Zip
Code<font color="#FF0000">*</font></font></div></td>
<td colspan="3"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<input name="Zip Code2" type="text" id="Zip Code22" size="15" maxlength="15">
</font></td>
</tr>
<tr>
<td><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Phone<font color="#FF0000">*</font></font></div></td>
<td colspan="3"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<input name="Phone" type="text" id="Phone3" size="15" maxlength="20">
</font></td>
</tr>
<tr>
<td><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Email<font color="#FF0000">*</font></font></div></td>
<td colspan="3"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<input name="Email" type="text" id="Email3" size="30" maxlength="70">
</font></td>
</tr>
<tr>
<td><div align="right"></div></td>
<td colspan="3"><label for="textfield"></label> </td>
</tr>
<tr>
<td><div align="right">
<label for="label2"></label>
</div></td>
<td colspan="3"><label for="label"></label>
</td>
</tr>
</table>


</p>
</fieldset></td>
</tr>
<tr>
<td height="196" bgcolor="#FFFFCC"> <fieldset>
<legend><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Questions
and Comments</font></legend>
<font size="2" face="Verdana, Arial, Helvetica, sans-serif">

</font>
<table width="95%" border="0" align="center" cellspacing="5">
<tr>
<td width="100%"><div align="center"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Please
add additional comments or questions in the space provided
below.
<textarea name="Please add additional comments or questions in the space provided below." cols="40" rows="4" id="textarea4"></textarea>
</font></div></td>
</tr>
</table>
<p align="center">
<label>
<input name="Submit" type="submit" onClick="MM_validateForm('Contact Name','','R','Address3','','R','City3','','R','Zip Code22','','R','Phone3','','R','Email3','','R');re turn document.MM_returnValue" value="Submit">
</label>

<label>
<input name="Clear Form" type="reset" id="Clear Form2" value="Reset">
</label>
</p>
</fieldset></td>
</tr>
</table>
</form>
</div></td>
</tr>
</table>
</BODY>

Creative Insanity
12-06-2005, 10:13 PM
Ok see if you got a email will all the fake info hehe

Tested it from here and it seemed to be working fine.
It sent me here after the form was sent.
http://www.petsincredible.com/ ('http://www.petsincredible.com/')

dreamlynx
12-06-2005, 11:11 PM
creative is right it seemed to be okay. However there is no way me or creative can see if you go an email or if that is the place for the redirect you wanted. If it is you cool. Hey creative you give good advice dude.

Dreamlynx

Creative Insanity
12-06-2005, 11:23 PM
Hey creative you give good advice dude.
* worried look* Gee.. so that must mean I am doing it all wrong.. Oh dear LOL