Jump to content

blank page when retriving email


explore

Recommended Posts

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
Link to comment
Share on other sites

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 send
echo("$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]
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

That is incorrect, idealy it should be this:
[code]// check that $_POST['s1'] isset and that $_POST['s1'] is not empty
if (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]
Link to comment
Share on other sites

Hi thanks for taking time to help
this is my error now when adding the code this way
Parse 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]
Link to comment
Share on other sites

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 empty
if (isset($_POST['s1']) && !empty($_POST['s1'])){ //name of field 1
     $MailBody = 'Name : $' . _POST['s1'] . "\n";
}[/code]
Thats the correct way!
Link to comment
Share on other sites

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 empty
if (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]
Link to comment
Share on other sites

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]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.