View Full Version : PHP Mailer
Butters
September 23rd, 2008, 06:04 PM
Having trouble with a simple PHP mail form, here's the PHP for it:
<?php
$name = $_REQUEST['name'] ;
$email = $_REQUEST['email'] ;
$phone = $_REQUEST['phone'] ;
$date = $_REQUEST['date'] ;
$message = $_REQUEST['message'] ;
mail( "guestlist@glowstudents.com", "Request for Guestlist at GLOW.",
$message);
header( "Location: http://www.glowstudents.com/test/guestlist2.html" );
?>
How do I edit it so that all the information (name, email, phone, date and message) are sent in an email to that address? I'v tried putting the other $ tags in but it just gives me errors everytime.
Templarian
September 23rd, 2008, 06:19 PM
Also get in the habit of knowing if your posting or getting data. Request should only be used if your doing both (which is rare).
<?php
//Stay Organized
$name = $_REQUEST['name'];
$email = $_REQUEST['email'];
$phone = $_REQUEST['phone'];
$date = $_REQUEST['date'];
$message = $_REQUEST['message'];
$send = $message."\n\n".$name."\n".$email."\n".$phone."\n".$date;
$subject = "This is the subject";
$to = "guestlist@glowstudents.com";
$header = 'From: email@email.com' . "\r\n" .
'Reply-To: email@email.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $send, $header);
header( "Location: http://www.glowstudents.com/test/guestlist2.html" );
exit;
?>
Butters
September 24th, 2008, 07:52 AM
Hmmmm, seems like it works but when I open up the email only the text from the Message box text is there, none of the other stuff (like email, date, name etc) is...
Templarian
September 24th, 2008, 07:57 AM
Use $_POST instead of $_REQUEST
also do a
echo $send;
exit;
Butters
September 24th, 2008, 08:01 AM
Where do I put the echo bit?
Butters
September 24th, 2008, 08:07 AM
Nvmd, figured out where to put it but I don't want that (the echo thing), I want it to go to the page I made to tell people that their request has been submitted.
Oh and here's the HTML from Dreamweaver from the HTML file:
<td width="194" height="19" class="style3">Your name: </td>
<td width="183" height="19" class="style3"><input name="name" type="text" id="name" /></td>
</tr>
<tr>
<td class="style3"> </td>
<td height="19" class="style3"> </td>
</tr>
<tr>
<td class="style3">Your email address: </td>
<td height="22" class="style3"><input name="email" type="text" id="email"/></td>
</tr>
<tr>
<td class="style3"> </td>
<td height="22" class="style3"> </td>
</tr>
<tr>
<td class="style3">Your phone number:</td>
<td height="22" class="style3"><input name="phone" type="text" id="phone" /></td>
</tr>
<tr>
<td class="style3"> </td>
<td height="22" class="style3"> </td>
</tr>
<tr>
<td class="style3">The date you want guestlist for:</td>
<td height="22" class="style3"><input name="date" type="text" id="date" /></td>
</tr>
<tr>
<td class="style3"> </td>
<td height="22" class="style3"> </td>
</tr>
<tr>
<td height="22" colspan="2" class="style3">The first <strong>and</strong> last names of the people you would like to put on the guestlist seperated by commas:</td>
</tr>
<tr>
<td height="19" colspan="2" class="style3"> </td>
</tr>
<tr>
<td height="267" colspan="2" class="style3"><form method="post" action="sendmail.php">
<p><textarea name="message" rows="15" cols="40">
</textarea>
<br />
<input type="submit" />
Click <strong>once</strong> only. </p>
</form></td>
Templarian
September 24th, 2008, 09:05 AM
^I was making sure the data was actually being sent. Did your $send data correctly show up?
Your HTML is cut off so I can't see your form tag, but since it is redirecting for you its correctly posting to the page.
Butters
September 24th, 2008, 09:33 AM
Wait managed to fix it! Yay!
Would have been problems with HTML bit as I didn't put all of the form in the same table cell.
Thanks temp :)
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.