PDA

View Full Version : PHP emailing


confused!
11-08-2008, 08:39 PM
I have set up my PHP and everything works and goes to the right page, however when I receive the email all of the data fields are blank but the data labels are there. Any idea what could be going wrong? (this is my very first website that I have ever built from scratch.)

davidj
11-09-2008, 09:15 AM
post the PHP please

confused!
11-09-2008, 04:40 PM
<?php

/* subject and email*/
$emailSubject = 'Website Inquiry!';
$webMaster = 'themayfamily08@gmail.com';

/* gathering data */

$emailField = $_POST['email'];
$nameField = $_POST['name'];
$messageField = $_POST['message'];

$body = <<<EOD
<br><hr><br>
Email: $emailField <br>
Name: $nameField <br>
Message: $messageField <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
(my websit code goes here... too long for the post)
EOD;
echo "$theResults";

?>

This is what is emailed to me:
(Unknown Sender)

Email:
Name:
Message:

I have tried to do the $_Post / $_GET, as well as headers to header and 'email' to '$emailField' to 'emailField' and putting the >>> after the two ending EODs. What else should I try?

davidj
11-09-2008, 05:15 PM
now post your html

davidj
11-09-2008, 05:18 PM
wait

this is invalid

$body = <<<EOD
<br><hr><br>
Email: $emailField <br>
Name: $nameField <br>
Message: $messageField <br>
EOD;


needs to be like this...


$body = "<br><hr><br>
Email: $emailField <br>
Name: $nameField <br>
Message: $messageField <br>
";


note the quotes

confused!
11-09-2008, 05:19 PM
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Masayume Design Studio</title>
<script language="JavaScript" type="text/javascript">
//--------------- LOCALIZEABLE GLOBALS ---------------
var d=new Date();
var monthname=new Array("January","February","March","April","May","June","July","August","September","October","November","December");
//Ensure correct for language. English is "January 1, 2004"
var TODAY = monthname[d.getMonth()] + " " + d.getDate() + ", " + d.getFullYear();
//--------------- END LOCALIZEABLE ---------------
</script>
<style type="text/css">
<!--
body {
background-image: url(http://pinkdasies.powweb.com//masayume/Pinkdasies/imagebank/bkgrd1rev4.png);
background-repeat: no-repeat;
}
body,td,th {
font-family: Georgia, Times New Roman, Times, serif;
}
-->
</style>
</head>
<body>
<table width="100%" height="729" border="0" cellpadding="0" cellspacing="0">
<tr bgcolor=>
<td colspan="3" rowspan="2">&nbsp;</td>
<td height="83" colspan="1" id="logo" valign="bottom" align="center" nowrap="nowrap"><img src="http://pinkdasies.powweb.com//masayume/Pinkdasies/imagebank/ogtitlebkgrd.png" width="235" height="100" /> </td>
<td width="4">&nbsp;</td>
</tr>

<tr bgcolor=>
<td height="1" colspan="1" id="tagline" valign="top" align="center">&nbsp;</td>
<td width="4">&nbsp;</td>
</tr>
<tr>
<td width="189" height="590" valign="top">
<table width="165" height="532" border="0" cellpadding="2" cellspacing="0" id="navigation">
<tr>
<td width="165" height="26">&nbsp;</td>
</tr>
<tr>
<td width="165" height="85" align="center"><p><a href="http://pinkdasies.powweb.com//masayume/Pinkdasies/webpages/index.html"><img border="0" src="http://pinkdasies.powweb.com//masayume/Pinkdasies/imagebank/buttonhom.png" width="85" height="45" /></p>
</td>
</tr>
<tr><td></td></tr>
<tr>
<td width="165" height="114" align="center"><p><a href="http://pinkdasies.powweb.com//masayume/Pinkdasies/webpages/mdsabout.html"><img border="0" src="http://pinkdasies.powweb.com//masayume/Pinkdasies/imagebank/buttonabo.png" width="128" height="45" /></p>
</td>
</tr>
<tr><td></td></tr>
<tr>
<td width="165" height="109" align="center"><p><a href="http://pinkdasies.powweb.com//masayume/Pinkdasies/webpages/mdscontact.html"><img border="0" src="http://pinkdasies.powweb.com//masayume/Pinkdasies/imagebank/buttoncon.png" width="150" height="45" /></p>
</td>
</tr>
<tr><td></td></tr>
<tr>
<td width="165" height="109" align="center"><p><a href="http://pinkdasies.powweb.com//masayume/Pinkdasies/webpages/mdsoptun.html"><img border="0" src="http://pinkdasies.powweb.com//masayume/Pinkdasies/imagebank/buttonopp.png" width="185" height="45" /></p>
</td>
</tr>
<tr><td></td></tr>
<tr>
<td width="165" height="89" align="center"><p><a href="http://pinkdasies.powweb.com//masayume/Pinkdasies/webpages/mdsservice.html"><img border="0" src="http://pinkdasies.powweb.com//masayume/Pinkdasies/imagebank/buttonser.png" width="125" height="45" /></p>
</td>
</tr>
</table>
</td>
<td width="16"></td>
<td colspan="2" valign="top"><table border="0" cellspacing="3" cellpadding="0" width="544">

<tr>
<td width="538" height="33" align="center" class="pageName"><h2>&nbsp;</h2></td>
</tr>

<tr>
<td height="474" valign="top" align="Center" class="bodyText"><h3>We greatly appericate you and what you have to say. Every question and comment helps us improve the services that we offer.</h3>
<p><img src="http://pinkdasies.powweb.com//masayume/Pinkdasies/imagebank/thankucrd.png" width="233" height="287" /></p>
</td>
</tr>
</table> </td>
<td width="4"></td>
<td width="190" valign="top"><br />
&nbsp;<br />
<table border="0" cellspacing="0" cellpadding="0" width="190" id="leftcol">

<tr>
<td width="10"><img src="mm_spacer.gif" alt="" width="10" height="1" border="0" /></td>
<td width="170" class="smallText"><br />
<p><span class="subHeader">GRAPHIC DESIGN</span><br />
<font size="2">
We offer graphic design for advertising, promotional, and print. </font></p>

<p>&nbsp;</p>
<p>FASHION DESIGN</span><br />
<font size="2">
We design and hand craft fashion and promo apparel.</font></p>
<p>&nbsp;</p>
<p><span class="subHeader">WEB DESIGN</span><br />
<font size="2">
We offer web design for those whom want a new website or just want their current site made over. </font></p>
<br />
&nbsp;<br /> </td>
<td width="10">&nbsp;</td>
</tr>
</table>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p align="right"><font size="1"><em>Concept Design: Lacey Garcia</em></font></p>
<p align="right"><font size="1"><em>Web Design: Rhonda May</em></font></p></td>
<td width="6" align="right">&nbsp;</td>
</tr>
<tr>
<td width="189">&nbsp;</td>
<td width="16">&nbsp;</td>
<td width="4">&nbsp;</td>
<td width="567">&nbsp;</td>
<td width="4">&nbsp;</td>
<td width="190" align="right">
<p>&nbsp;</p> </td>
<td width="6">&nbsp;</td>
</tr>
</table>
</body>
</html>

davidj
11-09-2008, 05:34 PM
if you intend to offer a web design service you need to have a bit more experience

if you can create work to this standard... http://www.csselite.com/ then you are ready to go professional

////

Some of your paths to images are invalid!

confused!
11-09-2008, 06:43 PM
Now my email says this:

Email: ''
Name: ''
Message: ''

confused!
11-09-2008, 06:45 PM
How can they be invalid when the pull up on the website? Can you explain? Also, I'm an outlet for designers, not the main designer :D

davidj
11-10-2008, 05:42 AM
where is your form

davidj
11-10-2008, 05:58 AM
also where you have this...


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


this should be


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

confused!
11-10-2008, 02:58 PM
http://pinkdasies.powweb.com//masayume/Pinkdasies/webpages/mdscontact.html

Here is the link to my contact page that has the form.

and this is the email I got after changing what you have asked...


Email:
Name:
Message:

digitaldesperad
11-10-2008, 07:14 PM
$body = "

Email: $emailField \n
Name: $nameField \n
Message: $messageField \n
";

confused!
11-10-2008, 08:37 PM
I tried what was asked and I also tried it in various ways:

$body = "

Email: $emailField \n<br>
Name: $nameField \n<br>
Message: $messageField \n<br>
";

$body = "

Email: $emailField \n <br>
Name: $nameField \n <br>
Message: $messageField \n <br>
";

$body = "

Email: $emailField\n<br>
Name: $nameField\n<br>
Message: $messageField\n<br>
";

$body = "

Email: $emailField\n <br>
Name: $nameField\n <br>
Message: $messageField\n <br>
";

And still the email i receive is blank. :(

davidj
11-11-2008, 05:41 AM
follow the email tutorial on the site

i know this works

confused!
11-12-2008, 12:09 AM
Ok, so I'm following the videos, and I'm on part 7 of "A Beginner's Guide". When I hit F12 I receive error message 404:
Not Found

The requested URL /test/images/dwc.php was not found on this server.


Any idea? I figured if I'm going to learn then I should try to soak up all the free education I can.

edbr
11-12-2008, 01:24 AM
is that file on the server?

confused!
11-12-2008, 02:38 AM
Yes, it is on the "server" - localroot and webroot, like instracted in the video.

confused!
11-12-2008, 02:39 AM
grrrr....alksdjflakfj....

As you can see i'm frustrated. :( I did everything I was told to do in the "Using Deamweaver and PHP to send form results in a email"... and now I receive an email from my own address... with "Results from form" and it is a blank email.... do you know if it is something to do with gmail maybe?

edbr
11-12-2008, 03:43 AM
cant see it being Gmail. try echoing your post fields on the action page to be sure they are being passed, just to check step by stepecho $_POST{'message'];
echo $_POST{'name'];
echo $_POST{'email']; im sure they are but check anyway

edbr
11-12-2008, 04:17 AM
i would test this. Make a new php page. either temporarilly and point the forms action to it or make a duplicate page add this in it

$email = $_POST['email'];
$name = $_POST['name'];
$message = $_POST['message'];
$recipient= "youremail@gmail.com";

mail($recipient,$email,$message, $from);
mkke this temporary as there is no validation so delete it from your server soon as you have tested it.
The only point in this is as before step by step trial , I'm a bit simple like that

davidj
11-12-2008, 09:58 AM
I'm officially handing this over ed

mek113
11-12-2008, 04:26 PM
Please excuse me if I'm stating the obvious here but are you entering any text into your fields before sending your test email?

mek113

confused!
11-13-2008, 12:58 AM
LOL, yes. yes i am entering text. I'm also doing it form different computers just to see if it may make a difference, alas, it does not.

confused!
11-13-2008, 01:19 AM
Ok, i tried what edbr suggested and i received the same email. Then I tried the echo idea and I got a blank page instead of it being the html result. Can I have some ones email address and I will give them access or email those two pages only to see if maybe i'm missing something all together?

edbr
11-13-2008, 02:14 AM
if the values are not being passed i would suggest it is your form check your code or make a new form and try that

edbr
11-13-2008, 03:32 AM
try this replace or make new with this
<form name="myForm" action="http://pinkdasies.powweb.com//masayume/Pinkdasies/webpages/thanku2.php" method="post" >


<table width="348" border="0" cellpadding="0" cellspacing="0" align="center">
<tr>
<td width="80" height="35" valign="middle" style="word-wrap: break-word;"><span class="style1">*</span>Name:</td>
<td width="268" height="35" valign="middle"><input name="name" type="text" id="name" size="30" /></td>
</tr>

<tr>
<td height="35" valign="middle"><span class="style1">*</span>Email:</td>

<td height="35" valign="middle"><input name="email" type="text" id="email" size="30" /></td>
</tr>
<tr>
<td height="35" valign="middle"><span class="style1">*</span>Message:</td>
<td height="35" valign="middle"><textarea name="message" id="message" cols="35" rows="4"></textarea></td>
</tr>
<tr>

<td height="35" valign="middle">&nbsp;</td>
<td height="35" valign="middle"><input type="submit" class="button" name="Submit1" value="Submit">
<input type="reset" class="button">&nbsp;</td>
</tr>
</table>
</form>

confused!
11-13-2008, 05:02 AM
Yipee! It works thank you davidj and edbr so much for all of your help and racking your brains with me. I am so appreciative of your knowledge and your help. I am going to continue to watch the tutorials so i can further my learning and understanding. I started building my website by reverse enginering other websites that I liked...basicly I learned to read code the hardway and now that I know about Dreamweaver and there are fourms like this, I feel it will be much easier for me to learn. Thank you!