Jump to content

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="redarrow@redarrow.com";
$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";

?>

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.