Jump to content

Form sends to an e-mail... Please heeelp!! :blink:


megan
 Share

Recommended Posts

Hi all!I'm a newbie here... so glad that I found this forum because I really need someone to help me with a form that I'm working on.I've just started with PHP-programming a few weeks ago, so I know nothing about this language :) Anyways, I'm working on a contact form that consists of some fields and two buttons. What I would like to form to be is that when someone clicks on the Send-button, the content will be sent to my e-mail and then, a page says "Your message has been sent" or something like that shows up. Now, to the problem that I'm struggling with... how can I get the content of the form to be sent to my e-mail and how can this "thank you" page show up??? Instead of sending to an e-mail, I tried to send to another php-page and it worked fine, though. Thank you so much for all your help in advance and hopefully I'll hear from you guys soon :) tata,megan

Link to comment
Share on other sites

Hi again,Here is the code of the form... Parts of the code is from FrontPage, though. When I try to run this page, the error message says the last line is incorrect. Can someone please tell me what have I done wrong here???

<html>    <head>    <title>Velkommen til Metro Trafikkskole</title>    </head><body><div style="position: absolute; width: 977px; height: 127px; z-index: 1; left: 9px; top: 13px" id="Meny">  <p align="center">  <img border="0" src="MetroTrafikkskolelog03.jpg" width="549" height="110"></p>  <p align="center">  <b>  <font face= "Verdana" size "3">  <a href="index.htm" style = "text-decoration: none">  <font color="#000099">Hovedside</font></a>      <a style="text-decoration: none" href="Forekort.htm"><font color="#000099">Førekort</font></a>      <a href="Moped.htm" style="text-decoration: none">  <font color="#000099">Moped</font></a>      <a href="Motorsykkel.htm" style="text-decoration: none">  <font color="#000099">Motorsykkel</font></a><font color="#000099">     <a href="Kursoversikt.htm"><font color="#000099">  <span style="text-decoration: none">Kursoversikt</span></font></a></font>      <a href="Priser.htm" style= "text-decoration: none">  <font color="#000099">Priser</font></a>      <a href="OmOss.htm" style="text-decoration: none">  <font color="#000099">Om Oss</font></a>      <a href="KontaktOss.htm" style="text-decoration: none">  <font color="#000099">Kontakt Oss</font></a></font></b></p></b><hr></div><p align="center"></p><div style="position: absolute; width: 976px; height: 338px; z-index: 2; left: 10px; top: 198px" id="layer2">  <font face="Verdana" size="1">Du er her : <b>Kontakt Oss</b></font></div><?phpif ($Navn == ""){	echo "<p class=bodymd><b>Navn:</b><br><input type=text name=Navn>*</p>";}else{	echo "<input type=hidden name=Navn value=$Navn>";}if ($Mail == ""){	echo "<p class=bodymd><b>E-post: </b><br><input type=text name=Mail>*</p>";}else{	echo "<input type=hidden name=Mail value=$Mail>";}if ($Telefon == ""){	echo "<p class=bodymd><b>Telefon/Mobil: </b><br><input type=text name=Telefon>*</p>";}else{	echo "<input type=hidden name=Telefon value=$Telefon>";}if ($Tittel == ""){	echo "<p class=bodymd><b>Tittel:</b><br><input type=text name=Tittel>*</p>";}else{	echo "<input type=hidden name=Tittel value=$Tittel>";if ($Melding == ""){	echo "<p class=bodymd><b>Melding:</b><br><textarea name=Comments rows=12 cols=63></textarea></p>";}else{	echo "<input type=hidden name=Melding value=$Melding>";}if (($Navn == "") || ($Mail == "") || ($Telefon == "") || ($Melding == "")){	echo "<input type=submit name=Submit value=Send>";	echo "<input type=reset name=Reset value=Avbryt>";	echo "</form>";}else{	$message = "Navn: $Navn\nMail: $Mail\nTelefon: $Telefon\nMelding: $Melding\n";	$extra = "From: $Navn\r\nReply-To: $Mail\r\n";	mail("candy@truong.as", $message,$extra);	echo "<p class=bodymd>Meldingen er sendt. Takk for din henvendelse!</p>";	echo "<p class=bodymd>Med vennlig hilsen,</br>";	echo "<p class=bodymd><Metro Trafikkskole/p>";}?></body></html>

Thanks,megan

Link to comment
Share on other sites

Hi and welcome to the forum,Your page indicates that you have a pretty good idea of how to implement php's mail function. You are missing an opening form tag and a field (Melding) needs to match your variable name, you have a missing '}', and don't forget that the mail function's arguments are TO, SUBJECT, MESSAGE, HEADERS.php mail()I'll send you a PM with a working copy.Thanks,

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...