Jump to content

Php Email Form sending blank emails


URmusicandvideo

Recommended Posts

I have created a basic form php script from a video on youtube and I seem to have all working but when I get the email it shows the fields name, address etc... but the fields are blank.

 

Here is the code:

<?php
$emailsubject = 'Judgement Recovery Application' ;
$web = '337@urmusicandvideo.com' ;



$casenumberField = $_POST['Casenu'];
$amountField = $_POST['Amountofjudgment'];
$collectedField = $_POST['Amountcollected'];
$stateField = $_POST['Statejudgment'];
$attnField = $_POST['Represented'];
$defaultField = $_POST['Awardeddefault'];
$dstateField = $_POST['dstate'];
$namejdField = $_POST['JD'];
$addjdField = $_POST['JDaddress'];
$cityjdField = $_POST['JDcity'];
$namejcField = $_POST['JCsName'];
$addjcField = $_POST['JCsAddress'];
$cityjcField = $_POST['JCsCity'];
$phoneField = $_POST['JCsPhone'];
$emailjcField = $_POST['JCsEmail'];
$descrpField = $_POST['Description'];
$judgeField = $_POST['Judgment'];

$body = <<<EOD
<br><hr><br>
Case Number: $casenumber <br>
Amount: $amount <br>
Collected: $collected <br>
State of Judgement: $state <br>
Attorney: $attn <br>
Award by Default: $default <br>
JD Reside Diffent State: $dstate <br>
Name: $namejd <br>
Address: $addjd <br>
City: $cityjd <br>
Phone: $phone <br>
Email: $emailjc <br>
Description: $descrp <br>
Judgement: $judge <br>
EOD;



$headers = "From:emailjcField\r\n";
$headers .= "Content-type: text/html\n\n";
$success = mail($web, $emailsubject, $body, $headers);



$theResults = <<<EOD
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Refresh" content="5; url=http://www.hydeandseik.com/home.html"> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Thank you From  Hyde & Seik Investigations</title>

<style type="text/css">
<!--
body {
background-image: url(images/bg.jpg);
}
.style7 {
color: #FFFFFF;
font-weight: bold;
font-size: 18px;
}
.style13 {font-family: Broadway}
.style15 {font-size: xx-large}
-->
</style></head>

<body>

<div align="center"></div>
<h1 align="center" class="style7"><span class="style15"><span class="style13">Hyde & Seik</span>®</span><span class="style15"> Thanks you for your application and we will be in contact with you soon.</span></h1>
<p align="center"> </p>
<p align="center"> </p>
</body>
</html>
EOD;
echo "$theResults";



?> 

 

 

Thank you for all your help

Lee

Link to comment
Share on other sites

Hi Lee,

 

Give this a try:

 

<?php
$emailsubject = 'Judgement Recovery Application' ;
$web = '337@urmusicandvideo.com' ;



$casenumberField = $_POST['Casenu'];
$amountField = $_POST['Amountofjudgment'];
$collectedField = $_POST['Amountcollected'];
$stateField = $_POST['Statejudgment'];
$attnField = $_POST['Represented'];
$defaultField = $_POST['Awardeddefault'];
$dstateField = $_POST['dstate'];
$namejdField = $_POST['JD'];
$addjdField = $_POST['JDaddress'];
$cityjdField = $_POST['JDcity'];
$namejcField = $_POST['JCsName'];
$addjcField = $_POST['JCsAddress'];
$cityjcField = $_POST['JCsCity'];
$phoneField = $_POST['JCsPhone'];
$emailjcField = $_POST['JCsEmail'];
$descrpField = $_POST['Description'];
$judgeField = $_POST['Judgment'];

$body = <<<EOD
<br><hr><br>
Case Number: $casenumberField <br>
Amount: $amountField <br>
Collected: $collectedField <br>
State of Judgement: $stateField<br>
Attorney: $attnField <br>
Award by Default: $defaultField <br>
JD Reside Diffent State: $dstateField<br>
Name: $namejdField <br>
Address: $addjdField <br>
City: $cityjdField <br>
Phone: $phoneField <br>
Email: $emailjcField <br>
Description: $descrpField <br>
Judgement: $judgeField <br>
EOD;



$headers = "From:emailjcField\r\n";
$headers .= "Content-type: text/html\n\n";
$success = mail($web, $emailsubject, $body, $headers);



$theResults = <<<EOD
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Refresh" content="5; url=http://www.hydeandseik.com/home.html"> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Thank you From  Hyde & Seik Investigations</title>

<style type="text/css">
<!--
body {
background-image: url(images/bg.jpg);
}
.style7 {
color: #FFFFFF;
font-weight: bold;
font-size: 18px;
}
.style13 {font-family: Broadway}
.style15 {font-size: xx-large}
-->
</style></head>

<body>

<div align="center"></div>
<h1 align="center" class="style7"><span class="style15"><span class="style13">Hyde & Seik</span>®</span><span class="style15"> Thanks you for your application and we will be in contact with you soon.</span></h1>
<p align="center"> </p>
<p align="center"> </p>
</body>
</html>
EOD;
echo "$theResults";



?> 

Link to comment
Share on other sites

You are not checking that anything has been posted, so how do you know if the post has a value?

My advice don't just follow videos, try and learn what the code is doing  and how its doing it ,rather than just knowing that it does do it.

 

Tizag.com

&

w3schools.com

 

Good sites to learn php.

 

This is improved a bit

<?php
   $emailsubject = 'Judgement Recovery Application' ;
   $web = '337@urmusicandvideo.com' ;
   


   $casenumberField = $_POST['Casenu'];
   $amountField = $_POST['Amountofjudgment'];
   $collectedField = $_POST['Amountcollected'];
   $stateField = $_POST['Statejudgment'];
   $attnField = $_POST['Represented'];
   $defaultField = $_POST['Awardeddefault'];
   $dstateField = $_POST['dstate'];
   $namejdField = $_POST['JD'];
   $addjdField = $_POST['JDaddress'];
   $cityjdField = $_POST['JDcity'];
   $namejcField = $_POST['JCsName'];
   $addjcField = $_POST['JCsAddress'];
   $cityjcField = $_POST['JCsCity'];
   $phoneField = $_POST['JCsPhone'];
   $emailjcField = $_POST['JCsEmail'];
   $descrpField = $_POST['Description'];
   $judgeField = $_POST['Judgment'];
   
   $body ="
<br><hr><br>
Case Number: ".$casenumberField." <br>
Amount: ".$amountField." <br>
Collected: ".$collectedField." <br>
State of Judgement: ".$stateField."<br>
Attorney: ".$attnField." <br>
Award by Default: ".$defaultField." <br>
JD Reside Diffent State: ".$dstateField."<br>
Name: ".$namejdField." <br>
Address: ".$addjdField." <br>
City: ".$cityjdField." <br>
Phone: ".$phoneField." <br>
Email: ".$emailjcField." <br>
Description: ".$descrpField." <br>
Judgement: ".$judgeField." <br>
";



   $headers = "From:emailjcField\r\n";
   $headers .= "Content-type: text/html\n\n";
   $success = mail($web, $emailsubject, $body, $headers);
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Refresh" content="5; url=http://www.hydeandseik.com/home.html"> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Thank you From  Hyde & Seik Investigations</title>

<style type="text/css">
<!--
body {
   background-image: url(images/bg.jpg);
}
.style7 {
   color: #FFFFFF;
   font-weight: bold;
   font-size: 18px;
}
.style13 {font-family: Broadway}
.style15 {font-size: xx-large}
-->
</style></head>

<body>

<div align="center"></div>
<h1 align="center" class="style7"><span class="style15"><span class="style13">Hyde & Seik</span>®</span><span class="style15"> Thanks you for your application and we will be in contact with you soon.</span></h1>
<p align="center"> </p>
<p align="center"> </p>
</body>
</html>

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.