fazlionline Posted May 27, 2009 Share Posted May 27, 2009 Dear allI have created two pages, the first one is HTML Form and the second one is PHP ScriptMy html file name is email01.html, and its code is: <html><link href="school.css" rel="stylesheet" type="text/css"><body><table width="400" border="0" align="center" cellpadding="3" cellspacing="3"> <tr> <td><form id="form1" name="form1" method="post" action="email01.php"> <table width="400" border="1" cellpadding="7" cellspacing="3" bordercolor="#990000"> <tr> <td colspan="2" bgcolor="#FF9900"><h1>Send us your feed back:</h1></td> </tr> <tr> <td valign="top">Name:</td> <td><label> <input type="text" name="urname" id="urname" /> </label></td> </tr> <tr> <td valign="top">Email:</td> <td><label> <input type="text" name="uremail" id="uremail"> </label></td> </tr> <tr> <td valign="top">Message:</td> <td><label> <textarea name="urmessage" id="urmessage" cols="45" rows="5"></textarea> </label></td> </tr> <tr> <td colspan="2" align="center" valign="top"><label> <input type="submit" name="button" id="button" value="Send Your Message" /> </label></td> </tr> </table> </form> </td> </tr></table></body></html>And my PHP page name is email01.php, and its code is:<?php$email=$_POST['email'];$to = '123@mail.com';$subject = $_POST['urname'];$message = $_POST['urmessage'];$headers = "From: $uremail" . "\r\n" . 'Reply-To: webmaster@example.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion();echo "thanks, your message is sent!";?>When I press the send button, I get the message:thanks, your message is sent!But when I check my inbox, there is no any email!Need helpFazlionline Link to comment Share on other sites More sharing options...
Synook Posted May 27, 2009 Share Posted May 27, 2009 You're not actually calling mail()... Link to comment Share on other sites More sharing options...
vbsouthern Posted May 27, 2009 Share Posted May 27, 2009 Add this code to your script: mail($to, $subject, $message, $headers); Good Luck... Link to comment Share on other sites More sharing options...
fazlionline Posted May 28, 2009 Author Share Posted May 28, 2009 Yes, I know this code!But I want to add a field to my HTML file, where it can take “email” from the user, and when I check my inbox, there should be email form that “field email”.Thanks Link to comment Share on other sites More sharing options...
Synook Posted May 28, 2009 Share Posted May 28, 2009 ??? You still need to send the mail eventually... Link to comment Share on other sites More sharing options...
Ingolme Posted May 28, 2009 Share Posted May 28, 2009 You forgot to add $uremail = $_POST['uremail']; For security, I'd get rid of any \n and \r so that people can't use the headers to abuse your E-mail form: $uremail = preg_replace("/[\n\r]/", "", $_POST['uremail']); Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.