explore Posted June 27, 2006 Share Posted June 27, 2006 Hi i hope this is the right place to post this problem. I have a contact form on my site,when the form is filled out and sent all is well, i get the message saying email has been sent out. but when i go to retrieve the email the page is blank? what could be my problem Quote Link to comment Share on other sites More sharing options...
Orio Posted June 27, 2006 Share Posted June 27, 2006 What do you mean? You never recieve the emails?If so, can you post the script so we'll see if there are no problems with it?Orio. Quote Link to comment Share on other sites More sharing options...
explore Posted June 27, 2006 Author Share Posted June 27, 2006 hi i do get the email but the page is blank i filled in the form sent it got the confirmation i check my emails there the message i open it but its blank nothing there no writing Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted June 27, 2006 Share Posted June 27, 2006 Supply some code and we might be able to help. How are you creating the message part of the email? Quote Link to comment Share on other sites More sharing options...
explore Posted June 27, 2006 Author Share Posted June 27, 2006 Hi whenyou ask for the code do you want the php script you can also go to the site www.mypugpuppies.com[code]<html><base target="_self"><META HTTP-EQUIV="REFRESH" CONTENT="3;URL=http://www.google.com"></head><body bgcolor="FFFFFF" text="#444444"><?/*Script Made By Empire X. Support at http://www.empirex.net/forum/You can edit who the e-mail is sent to and the subject, look below.*/$MailTo = "julie@mypugpuppies.com"; //email to send the results to$MailSubject = "information"; //text in the Subject field of the mail$MailHeader = "From: My Pug Puppies"; //text in the From field of the mail$MailSent = "<center><img border=0 src=emailsent.gif width=450 height=350></center>"; //confirm image/* You can edit the for fields below */if ($s1 == ""){ //name of field 1}else { $MailBody = "Name :$_POST['1'] //This value is inserted inthe mailbody:$_POST['1']}if ($s2 == ""){}else { $MailBody .= "Company :$_POST['2']}if ($s3 == ""){}else { $MailBody .= "E-mail :$_POST['3']}if ($s4 == ""){}else { $MailBody .= "Subject : $_POST['4']}if ($s5 == ""){}else { $MailBody .= "Website Rating :$_POST['5'] }if ($s6 == ""){}else { $MailBody .= "Referral :$_POST['6']}if ($s7 == ""){}else { $MailBody .= "Message : $_POST['7']}//Routine to send message{mail($MailTo, $MailSubject, $MailBody, $MailHeader); //message sendecho("$MailSent"); //Confirmation message.}?><p><p><p><br><font face="verdana" size="1"><a href="http://www.empirex.net">Powered by Empire X Form Mail v.1.0</a> <a href="http://www.empirex.net/db/">From The X Database</a><p></body></html>[/code] Quote Link to comment Share on other sites More sharing options...
Orio Posted June 27, 2006 Share Posted June 27, 2006 You need to recieve the values. In your form, there are fields right? Depends on the method (GET or POST), you need to use the super-global vars according to the field names.For example, if your form has the following field:<input type="text" name="test123">And the method of the form is POST, the value of it be set on $_POST['test123'].You need to recieve the values from these super globals, and set the $s1, $s2 etc using them.Orio. Quote Link to comment Share on other sites More sharing options...
explore Posted June 27, 2006 Author Share Posted June 27, 2006 Hi ok I did some changes in the above code can you look at it and tell me if this is going to work Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted June 27, 2006 Share Posted June 27, 2006 That is incorrect, idealy it should be this:[code]// check that $_POST['s1'] isset and that $_POST['s1'] is not emptyif (isset($_POST['s1']) && !empty($_POST['s1'])){ //name of field 1 $MailBody = "Name :$_POST['s1'];}[/code]That code replaces this:[code]if ($s1 == ""){ //name of field 1}else { $MailBody = "Name :$_POST['1'] //This value is inserted inthe mailbody:$_POST['1']}[/code] Quote Link to comment Share on other sites More sharing options...
explore Posted June 27, 2006 Author Share Posted June 27, 2006 Hi thanks for taking time to helpthis is my error now when adding the code this wayParse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/julie1/public_html/formmail/formmail.php on line 22[code]($s1 == ""){ //name of field 1}else { $MailBody = "Name :$_POST['name']; }if ($s2 == ""){}else { $MailBody .= "Company : $_POST['company'];}if ($s3 == ""){}else { $MailBody .= "E-mail : $_POST['email'];[/code] Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted June 28, 2006 Share Posted June 28, 2006 You still havn't read my post correctly. Delete the following:[code]if ($s1 == ""){ //name of field 1}else { $MailBody = "Name :$_POST['name']; }[/code]And replace the baove with this:[code]// check that $_POST['s1'] isset and that $_POST['s1'] is not emptyif (isset($_POST['s1']) && !empty($_POST['s1'])){ //name of field 1 $MailBody = 'Name : $' . _POST['s1'] . "\n";}[/code]Thats the correct way! Quote Link to comment Share on other sites More sharing options...
explore Posted June 28, 2006 Author Share Posted June 28, 2006 Hi ok is this ok and can i keep the field with the names in like this here[code]// check that $_POST['s1'] isset and that $_POST['s1'] is not emptyif (isset($_POST['s1']) && !empty($_POST['s1'])){ //name of field 1 $MailBody = 'Name : $' . _POST['s1'] . "\n"; }if ($s2 == ""){}else { $MailBody .= "Company : $_POST['company'];}if ($s3 == ""){}else { $MailBody .= "E-mail : $_POST['email'];}if ($s4 == ""){}else { $MailBody .= "Subject : $_POST['subject'];}[/code] Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted June 28, 2006 Share Posted June 28, 2006 Yes thats ok for the First one, now you need to do it for the next three if/else statements. Make sure you have $_POST['s1'] to $_POST['s2'] for the secound if statement, $_POST['s3'] to the third if statement and so forth.So your code looks like this:[code]if (isset($_POST['s1']) && !empty($_POST['s1'])) { //name of field 1 $MailBody = 'Name : ' . $_POST['s1'] . "\n";}if (isset($_POST['s2']) && !empty($_POST['s2'])) { //name of field 2 $MailBody = 'Company : ' . $_POST['s2'] . "\n";}if (isset($_POST['s3']) && !empty($_POST['s3'])) { //name of field 3 $MailBody = 'E-mail : ' . $_POST['s3'] . "\n";}if (isset($_POST['s4']) && !empty($_POST['s4'])) { //name of field 4 $MailBody = 'Subject : ' . $_POST['s4'] . "\n";}[/code] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.