Jump to content

Trying to mail a submitted form...


kelharis

Recommended Posts

Hello everyone,

 

I am creating a short little form that will email the submitted information to someone using MS Outlook mail.  I have tested my code and it will email the correct email, email the correct subject, but I have an error somewhere in the "message" section.  I have probably just made some idiotic mistake as usual, but I can't find it.

 

here is the code, the message in the email just reads as the variable $message is written, i.e. "$name /n $email /n $school /n $diet"  Where am I going wrong?

 

<?php

  $name = $_REQUEST ['name'] ;
  $email = $_REQUEST['email'] ;
  $school = $_REQUEST['school'] ;
  $diet = $_REQUEST['diet'] ;
  $message = '$name /n $email /n $school /n $diet';
  mail( "XXXXXXXXX", "Subject: Leadership Seminar Signup",
  $message, "From: $email" );
  
  
//if "email" is not filled out, display the form

  echo "<center><form method='post' action='pages/leadershipform.php'>
  Name: <input name='name' type='text' /><br />
  Email: <input name='email' type='text' /><br />
  School: <input name='school' type='text' /><br />
  Special Dietary Needs:
  <input name='diet' type='text' />
  <br />
  <input type='submit' />
  </form>";

?>

Link to comment
https://forums.phpfreaks.com/topic/148307-trying-to-mail-a-submitted-form/
Share on other sites

sorry re edited

<?php


$name="redarrow";
$email="[email protected]";
$school="phpfreaks";
$diet="fat lol!";

$message1 = "$name \n $email \n $school \n $diet";



$message2 = ' '.$name.' \n '.$email.' \n '.$school.' \n '.$diet.' ';

echo "$message2 <br><br> $message2";

?>

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.