Jump to content

Can't figure out my basic Form-To-Email


hummerton

Recommended Posts

I have a form-to-email that I am trying to use. I'm testing, but I am not getting the orders that I send. Everything else I send to that email I get fine, so something definately wrong with my code somewhere. Thought I was ok (as a beginner) with PHP, but now my ego is taking a beating :)

 

It is contained all on 1 page - the below coding is the entire page:

<?php
if(isset($_POST['t1'])){
// **** CHANGE EMAIL, AFFILIATE ID & AFFILIATE LINK! ****

$mymail = '[email protected]';
$cc = 'Website installation (plus124)';
$BoDy = ' ';
$FrOm = "From: $_POST[t2]";
$FrOm .= "\r\nReply-To: $_POST[t2]";
$FrOm .= "\r\nX-MAILER: PHP".phpversion();
//Body sends all the sign up info to the $mymail address
$BoDy .= 'Website Chosen: ';
$BoDy .= $_POST['t1'];
$BoDy .= "\n";
$BoDy .= 'eMail Address: ';
$BoDy .= $_POST['t2'];
$BoDy .= "\n";
$BoDy .= 'Confirm eMail: ';
$BoDy .= $_POST['t3'];
$BoDy .= "\n";
$BoDy .= 'Hosting Info: ';
$BoDy .= $_POST['t4'];
$BoDy .= "\n";
$BoDy .= 'Hosting Password: ';
$BoDy .= $_POST['t5'];
$BoDy .= "\n";
$BoDy .= 'Sign Up Method: ';
$BoDy .= $_POST['t6'];
$BoDy .= "\n";
$send = mail("$mymail", "$cc", "$BoDy", "$FrOm");

///Redirect user to your homepage....
if($send)
{
echo '<html><head>';
echo '<meta http-equiv="refresh" content="0;URL=http://www.affiliscripts.com/124-thanks.php">';
echo '</head><body>Email send....';
echo '</body></html>';
}
}else{
?>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<link href="style.css" rel="stylesheet" type="text/css" />
<link href="layout.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="jquery.js"></script>
<script>
function toggle1(id){

		if(id == 1){$('#method1').slideDown('slow');
					$('#method2').slideUp('slow');
		}
		if(id == 2){$('#method2').slideDown('slow');
					$('#method1').slideUp('slow');
		}


			}
</script>
</head>

**** ALL BODY COING HERE

<?php include 'footer.php'; ?>
<?php } ?>

 

If anyone can see what I am doing wrong, I would LOVE it if you could let me know. I am sure it's something stupid... but I've looked at this coding for 2 days now and can't find a thing!

 

Thanks,

 

Rob

 

Link to comment
https://forums.phpfreaks.com/topic/255361-cant-figure-out-my-basic-form-to-email/
Share on other sites

Just comment out this line  // $send = mail("$mymail", "$cc", "$BoDy", "$FrOm");

 

and add a debugging line

 

echo 'my mail = '.$mymail.' cc = '.$cc.' body = '.$BoDy.' from = '.$FrOm.'<BR>';

 

and copy and paste the relevant message that you get on the screen

 

 

Hello :)

 

When I do that and submit the form, I get this:

 

my mail = [email protected] cc = Website installation (plus124) body = Website Chosen: eMail Address: Confirm eMail: Hosting Info: Hosting Password: Sign Up Method: Method 1(Average User) from = From: Reply-To: X-MAILER: PHP5.2.17

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.