|
|
andrew1971
regular
Reg'd: Mon
Posts: 1996
Loc: England
|
|
On our website we bave our email address for people to contact us. I don't think this is working as I presume customers would rather fill in a form direct then having to open up their email account.
Can anybody help with the code I need to set up a form for name, address and a large comment box with a submit to go direct to our email address. I've tried to do it a few times but keep coming to a brick wall.
Many thanks.
|
|
emailuser
regular
Reg'd: Wed
Posts: 190
|
|
Is it free isp webspace or proper commercial webspace your using ? .
|
andrew1971
regular
Reg'd: Mon
Posts: 1996
Loc: England
|
|
It's a free commercial webspace.
This is how I've done it
<FORM action="mailto:orders@mydomain.co.uk"> Item Code: <INPUT name="Name" value="" size="20"><BR> Email: <INPUT name="Email" value="" size="30"> Method of payment: <input "method" value="" sze="20"> Message:<TEXTAREA NAME="comment" ROWS=6 COLS=40> </TEXTAREA><br> <INPUT TYPE="submit"> <INPUT TYPE="reset"> </FORM>
When I preview it, it shows the boxes but the submit button says submit query. I'd rather it said something like confirm order. Even if I didn't use OE would the messages still go to our website email account? or would I need to have OE activated?
Edited by TheFatControlleR (Wed Sep 27 2006 01:53 PM)
|
emailuser
regular
Reg'd: Wed
Posts: 190
|
|
Free commercial webspace means i dont know what features your webspace does or doesnt have & cant really help you much .
I see your post was edited by the fat controller and as it doesnt say what was edited or removed i suppose it is possible you posted a url that would have helped me .
TFC: not getting at you or anything - but this does highlight a point and perhaps it would be a good idea if you and the other mods started to say what was edited or removed .
|
andrew1971
regular
Reg'd: Mon
Posts: 1996
Loc: England
|
|
the part that was edited was our email address. Sorry I meant to say it is a paid for webspace (with fasthosts) unsure why I said free.
|
emailuser
regular
Reg'd: Wed
Posts: 190
|
|
If your using fasthosts then you will have php and in that case its much better to use php .
The form is in two parts , The first part being the actual entry boxes , The second part being the webpage that sends the entered data to your email address .
$mailhead = "From: andrew@yourdomain.co.uk \n";
$soap="andrew@yourdomain.co.uk";
The only 2 things you need to do is change the above in the second part for the script to work .
You dont need to remove the css or anything else as the browser will just ignore it - the first thing to do is to check the script works ok after changing your email address and uploading both pages to your webspace .
<html> <head> <title>form.php</title> </head>
<body>
<table width="950" border="0" cellspacing="5" cellpadding="0" align="center" class="formfill1">
<form action="form_check.php" method="post" name="duff">
<tr valign="top"> <td align="right" class="form_three">Real Name <img src="images/dod01.jpg" width="20" height="14" border="0" alt=""></td> <td class="bbb"> </td> <td> <input type="text" name="ff1" size="70" class="formbox_one"> <span class=kka> e.g. John J Rambo</span> </td> </tr>
<tr valign="top"> <td align="right" class="form_three">User Name <img src="images/dod01.jpg" width="20" height="14" border="0" alt=""></td> <td class="bbb"> </td> <td> <input type="text" name="ff2" size="70" class="formbox_two"> <span class=kka> e.g. <span class=yya>rambo_2006</span> (2 char min - 20 char max)</span> </td> </tr>
<tr valign="top"> <td align="right" class="form_three">Password <img src="images/dod01.jpg" width="20" height="14" border="0" alt=""></td> <td class="bbb"> </td> <td><input type="text" name="ff3" size="70" class="formbox_three"> </td> </tr>
<tr valign="top"> <td align="right" class="form_three">Email Address <img src="images/dod01.jpg" width="20" height="14" border="0" alt=""></td> <td class="bbb"> </td> <td><input type="text" name="ff4" size="70" class="formbox_four"></td> </tr>
<tr valign="top"> <td align="right" class="form_four">5 DIGIT ANTI SPAM CODE <img src="images/arrow_right.gif" width="11" height="8" border="0" alt=""></td> <td class="bbb"> </td> <td><input type="text" name="ff5" size="30" class="formbox_five"></td> </tr>
<tr valign="top"> <td class="bbb"> </td> <td class="bbb"> </td> <td><input type="submit" name="Submit" value="S U B M I T" class="sub_nav_ie"></td> </tr>
<tr valign="top"> <td align="right" class="kka">e.g.</td> <td class="bba"> </td> <td align="left" class="kka">after you have signed up you would use something like <span class=yya>www.emailuser.co.uk/?name=rambo_2006</span></td> </tr>
</form>
</table>
</body> </html>
<html> <head> <title>form_check.php</title> </head>
<body>
<?php
$subject="EMAIL USER (SIGNUP) " . "(No. $hod[1])";
$mailhead = "From: andrew@yourdomain.co.uk \n";
$mailbody ="USER NAME: " . "$hod[5]" . "\n"; $mailbody .="PASSWORD: " . "$hod[6]" . "\n"; $mailbody .="EMAIL ADDRESS: " . "$hod[8]" . "\n\n"; $mailbody .="Hi " . "$hod[4]" . "\n\n"; $mailbody .="This is your welcome email that contains your validation code" . "\n\n"; $mailbody .="$hod[36]" . "\n\n"; $mailbody .="www.emailuser.co.uk/validate.php" . "\n\n"; $mailbody .="Visit the EU website and enter the validation code shown above to validate your account" . "\n\n"; $mailbody .="Or if your email client allows you can use the following one click url to validate your account" . "\n\n"; $mailbody .="www.emailuser.co.uk/validate_oneclick.php?code=" . "$hod[36]" . "\n\n"; $mailbody .="PLEASE NOTE: passwords cannot be recovered and you are advised to printout this email" . "\n\n";
$body .=stripslashes($mailbody);
$soap="andrew@yourdomain.co.uk"; mail($soap,$subject,$body,$mailhead);
$soap="$hod[8]"; $soap=str_replace(",","",$soap); $soap=str_replace(" ","",$soap); $soap=str_replace("\n","",$soap); $soap=str_replace("\r","",$soap); $soap=str_replace("\t","",$soap); $soap=str_replace("%0D","",$soap); $soap=str_replace("%0A","",$soap); $soap=str_replace("bcc:","",$soap); $soap=str_replace("cc:","",$soap); $soap=str_replace("to:","",$soap); $soap=str_replace("acc:","",$soap); mail($soap,$subject,$body,$mailhead);
?>
</BODY> </HTML>
If everything works as intented and you recieve the email ok - then you can start to edit and change both webpages to suit what ever it is you want it to do .
I will help you with that if needed - but no point going any further until you have checked it works ok .
|
emailuser
regular
Reg'd: Wed
Posts: 190
|
|
$body .=stripslashes($mailbody);
$soap="andrew@yourdomain.co.uk"; mail($soap,$subject,$body,$mailhead);
?>
</BODY> </HTML>
My mistake - delete the last part of code so it looks like the above .
You dont need the removed part as it was like a carbon copy email that was sent to the user who signed up using the email address they supplied in the form .
|
TheFatControlleR
Forum Admin
Reg'd: Fri
Posts: 6556
Loc: Megatripolis
|
|
Quote:
the part that was edited was our email address...
A precautionary edit. I wasn't sure if it would be picked up by spiders/bots, etc., resulting in a shed-load of spam hitting your inbox.
--------------------
TFC
'Going to trial with a lawyer who considers your whole life-style a Crime in Progress is not a happy prospect.' - Hunter S Thompson (1937-2005)
|
andrew1971
regular
Reg'd: Mon
Posts: 1996
Loc: England
|
|
Thanks. Couple of things I need to clarify. When I preview the form it shows a password and 5 digit validation code. Can I delete these from the text?
edited. Sorry but now I'm struggling with a couple of things. The code shows that it will validate a code sent to the email account. I don't really want this. It's a very good code to have but it may be too much for what I am looking for. I just want a basic form that will take the customers order and send it direct to our orders email account, instead of them having to open up their email account. The code that you gave us emailuser shows things such as passwords, validation codes and confirmation links.
Too much for what I need really. The basics I want is Name. Item Code. email address. Message. then Submit.
Thanks for that emailuser it was much appreciated.
Edited by andrew1971 (Wed Sep 27 2006 05:00 PM)
|
emailuser
regular
Reg'd: Wed
Posts: 190
|
|
You can ignore all the code validate stuff - as i roughly said above it was more important to find out if it worked on your webspace and you did recieve the email after you clicked on the submit button - the actual content of the email you recieve is unimportant at this stage .
But yes you can delete and change anything you want .
|