Jump to content

[SOLVED] email doesn't bring up user info? helpm please


djlingo10

Recommended Posts

Hi everyone can some one please help i am stuck and dont know what to do. i built a contact form in html and i built a php script to call the info. but when a user types in there info send it it comes out looking like this

 

Name:

Email:

Comments:

 

with none of there info i cant figure it out so if some on could help it would be great. bellow i provided the script.

 

-----------------------------------------------------------------------------------------------------------------------------------------------

<?php

 

/* Subject and Email Variables */

 

     $emailSubject =  'clients';

$webMaster = '[email protected]';

 

 

/* Gathering Data Variables*/

 

$nameField = $_POST['name'];

$emailField = $_POST['email'];

$commentsField = $_POST['comments'];

 

$body = <<<EOD

<br><hr><br>

Name: $name <br>

Email: $email <br>

Comments: $comments <br>

EOD;

 

$headers = "From: $email\r\n";

$headers .= "Content-type: text/html\r\n";

$success = mail($webMaster, $emailSubject, $body, $headers);

 

/* Results rendered as HTML */

 

 

$theResults = <<<EOD

<html>

<head>

<title>thankyou</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<style type="text/css">

<!--

body {

background-color: #f1f1f1;

font-family: Verdana, Arial, Helvetica, sans-serif;

font-size: 12px;

font-style: normal;

line-height: normal;

font-weight: normal;

color: #666666;

text-decoration: none;

}

-->

</style>

</head>

 

<div>

  <div align="left">Thank you for your interest! Your email will be answered very soon!</div>

</div>

</body>

</html>

EOD;

echo "$theResults";

 

?>

----------------------------------------------------------------------------------------------------------------------------------------------------

 

<html>

<head>

<title>contact</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<script type="text/javascript">

<!--

function MM_preloadImages() { //v3.0

  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();

    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)

    if (a.indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a;}}

}

 

function MM_swapImgRestore() { //v3.0

  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a)&&x.oSrc;i++) x.src=x.oSrc;

}

 

function MM_findObj(n, d) { //v4.01

  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {

    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}

  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[n];

  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers.document);

  if(!x && d.getElementById) x=d.getElementById(n); return x;

}

 

function MM_swapImage() { //v3.0

  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)

   if ((x=MM_findObj(a))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}

}

//-->

</script>

</head>

<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="MM_preloadImages('into_rollover/home.jpg','into_rollover/contact.jpg','into_rollover/services.jpg','into_rollover/maids.jpg','into_rollover/rules.jpg','into_rollover/jobs.jpg','into_rollover/about_us.jpg')">

<!-- ImageReady Slices (homec.psd) -->

<table id="Table_01" width="1024" height="769" border="0" cellpadding="0" cellspacing="0">

<tr>

<td rowspan="4">

<img src="images/left_grad1.jpg" width="63" height="768" alt=""></td>

<td rowspan="4">

<img src="images/left_boarder.gif" width="9" height="768" alt=""></td>

<td colspan="10">

<img src="images/title.jpg" width="881" height="104" alt=""></td>

<td rowspan="4">

<img src="images/right_boarder.gif" width="10" height="768" alt=""></td>

<td rowspan="4">

<img src="images/right_grad1.jpg" width="61" height="768" alt=""></td>

</tr>

<tr>

<td>

<img src="images/lft_blank_nav.gif" width="212" height="30" alt=""></td>

<td colspan="2">

<a href="main.html"><img src="images/home.jpg" alt="" name="Image1" width="59" height="30" border="0" id="Image1" onMouseOver="MM_swapImage('Image1','','into_rollover/home.jpg',1)" onMouseOut="MM_swapImgRestore()"></a></td>

<td>

<a href="about_us.html"><img src="images/about_us.jpg" alt="" name="Image2" width="76" height="30" border="0" id="Image2" onMouseOver="MM_swapImage('Image2','','into_rollover/about_us.jpg',1)" onMouseOut="MM_swapImgRestore()"></a></td>

<td>

<a href="services.html"><img src="images/services.jpg" alt="" name="Image3" width="73" height="30" border="0" id="Image3" onMouseOver="MM_swapImage('Image3','','into_rollover/services.jpg',1)" onMouseOut="MM_swapImgRestore()"></a></td>

<td>

<a href="maids.html"><img src="images/maids.jpg" alt="" name="Image4" width="55" height="30" border="0" id="Image4" onMouseOver="MM_swapImage('Image4','','into_rollover/maids.jpg',1)" onMouseOut="MM_swapImgRestore()"></a></td>

<td>

<a href="rules.html"><img src="images/rules.jpg" alt="" name="Image5" width="56" height="30" border="0" id="Image5" onMouseOver="MM_swapImage('Image5','','into_rollover/rules.jpg',1)" onMouseOut="MM_swapImgRestore()"></a></td>

<td>

<a href="jobs.html"><img src="images/jobs.jpg" alt="" name="Image6" width="47" height="30" border="0" id="Image6" onMouseOver="MM_swapImage('Image6','','into_rollover/jobs.jpg',1)" onMouseOut="MM_swapImgRestore()"></a></td>

<td>

<a href="contact.html"><img src="images/contact.jpg" alt="" name="Image7" width="100" height="30" border="0" id="Image7" onMouseOver="MM_swapImage('Image7','','into_rollover/contact.jpg',1)" onMouseOut="MM_swapImgRestore()"></a></td>

<td>

<img src="images/rght_blank_nav.gif" width="203" height="30" alt=""></td>

</tr>

<tr>

<td colspan="2">

<img src="images/model_home.jpg" width="235" height="588" alt=""></td>

<td colspan="8" background="images/content_contact.jpg"><form name="form1" method="post" action="contact2.php">

  <table width="645" border="0">

            <tr>

              <td> </td>

              <td><div align="right">Name</div></td>

              <td><div align="left">

                <label for="name"></label>

                <input type="text" name="name" id="name">

              </div></td>

              <td> </td>

            </tr>

            <tr>

              <td> </td>

              <td><div align="right">

                <label for="email">Email</label>

              </div></td>

              <td><div align="left">

                <input type="text" name="email" id="email">

              </div></td>

              <td> </td>

            </tr>

            <tr>

              <td> </td>

              <td><div align="right">

                <label for="comments">Comments/Questions</label>

              </div></td>

              <td><div align="left">

                <textarea name="comments" rows="5" id="comments"></textarea>

              </div></td>

              <td> </td>

            </tr>

            <tr>

              <td> </td>

              <td><div align="right"></div></td>

              <td><div align="left">

                <label for="submit"></label>

                <input type="submit" name="submit" id="submit" value="Submit">

                <label for="reset"></label>

                <input type="reset" name="reset" id="reset" value="Reset">

              </div></td>

              <td> </td>

            </tr>

            <tr>

              <td> </td>

              <td><div align="right"></div></td>

              <td><div align="left"></div></td>

              <td> </td>

            </tr>

            <tr>

              <td> </td>

              <td><div align="right">Office: </div></td>

              <td><div align="left">(909) 262-8101</div></td>

              <td> </td>

            </tr>

            <tr>

              <td> </td>

              <td><div align="right"></div></td>

              <td><div align="left"></div></td>

              <td> </td>

            </tr>

            <tr>

              <td> </td>

              <td><div align="right"></div></td>

              <td><div align="left"></div></td>

              <td> </td>

            </tr>

            <tr>

              <td> </td>

              <td><div align="right"></div></td>

              <td><div align="left"></div></td>

              <td> </td>

            </tr>

            <tr>

              <td> </td>

              <td><div align="right"></div></td>

              <td><div align="left"></div></td>

              <td> </td>

            </tr>

            <tr>

              <td> </td>

              <td><div align="right"></div></td>

              <td><div align="left"></div></td>

              <td> </td>

            </tr>

            <tr>

              <td> </td>

              <td><div align="right"></div></td>

              <td><div align="left"></div></td>

              <td> </td>

            </tr>

          </table>

                </form>

  </td>

  </tr>

<tr>

<td colspan="10">

<img src="images/bottom.jpg" width="881" height="46" alt=""></td>

</tr>

<tr>

<td>

<img src="images/spacer.gif" width="63" height="1" alt=""></td>

<td>

<img src="images/spacer.gif" width="9" height="1" alt=""></td>

<td>

<img src="images/spacer.gif" width="212" height="1" alt=""></td>

<td>

<img src="images/spacer.gif" width="23" height="1" alt=""></td>

<td>

<img src="images/spacer.gif" width="36" height="1" alt=""></td>

<td>

<img src="images/spacer.gif" width="76" height="1" alt=""></td>

<td>

<img src="images/spacer.gif" width="73" height="1" alt=""></td>

<td>

<img src="images/spacer.gif" width="55" height="1" alt=""></td>

<td>

<img src="images/spacer.gif" width="56" height="1" alt=""></td>

<td>

<img src="images/spacer.gif" width="47" height="1" alt=""></td>

<td>

<img src="images/spacer.gif" width="100" height="1" alt=""></td>

<td>

<img src="images/spacer.gif" width="203" height="1" alt=""></td>

<td>

<img src="images/spacer.gif" width="10" height="1" alt=""></td>

<td>

<img src="images/spacer.gif" width="61" height="1" alt=""></td>

</tr>

</table>

<!-- End ImageReady Slices -->

</body>

</html>

 

[attachment deleted by admin]

hmmm, seems to me you forgot you named the variables ro something:

 

<?php

   $nameField = $_POST['name'];
   $emailField = $_POST['email'];
   $commentsField = $_POST['comments'];
   
   $body = <<<EOD



Name: $name

Email: $email

Comments: $comments

EOD;

?>

 

-----

 

i believe it should be:

 

<?php

   $nameField = $_POST['name'];
   $emailField = $_POST['email'];
   $commentsField = $_POST['comments'];
   
   $body = <<<EOD



Name: $nameField

Email: $emailField

Comments: $commentsField

EOD;

?>

 

I cant remember the name of the method of assigning your body variable. but i believe direct assignment with " Quote symbols is better practice - You can concatenate, use PHP code inside an assignment, and is usually a lot easier to read.

 

Hope this helps.

 

(if it doesn't use print_r($_POST); at the top of contact2.php to confirm values are transfering from the original form)

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.