Jump to content

Form Submission Issues


Riley Murphy

Recommended Posts

First of all, hello! I'm so glad I found this place! My website is almost ready and getting this thing working is the last thing I need to do before it's declared open for business. :)

 

Second, please be gentle. I'm a total newb. The mistake is probably something completely, profoundly stupid. I wrote a bit of PHP when I was in school, but haven't picked it up in several years now, and my knowledge is simplistic at the very best. I actually picked it up again just to get this site working.  :-[ For context, it's a kind of travel-based project.

 

Finally, the problem is that it seems like the code below does everything except gather the information. It redirects to the page acknowledging the email submission. It does in fact send the email, promptly and to the correct address. But the email only contains the sort of "filler" text and none of the user-submitted information. I've juggled it around a bit, but now I'm out of ideas and afraid of breaking it more. :shrug: It should be a piece of cake for you guys, though, so can anyone see what's going wrong here? (I checked the names of the fields, and they all match.)

 

<?php
$name = $REQUEST['name'];
$place = $REQUEST["place"];
$dare = $REQUEST["dare"];
$email = $REQUEST["email"];

mail( "dares@heyhitchhiker.com", "Hey, Hitchhiker!", "Someone called $name thinks you should go to $place for the purposes of $dare. You can get back to them at $email.", "From:$email" );

header( "Location: daresubmitted.html");

?>

Link to comment
Share on other sites

Try this

 

<?php
$name = $_POST['name'];
$place = $_POST["place"];
$dare = $_POST["dare"];
$email = $_POST["email"];

mail( "dares@heyhitchhiker.com", "Hey, Hitchhiker!", "Someone called {$name} thinks you should go to {$place} for the purposes of {$dare}. You can get back to them at {$email}.", "From:$email" );

header( "Location: daresubmitted.html");

?>

Link to comment
Share on other sites

Try

<?php
$to = "dares@heyhitchhiker.com";
$subject = "Hey, Hitchhiker!";
$message = "Someone called '".$_POST['name']."' thinks you should go to '". $_POST["place"]."' for the purposes of '".$_POST["dare"]."'. You can get back to them at '".$_POST["email"]."'."
$from = "$email";

mail($to, $subject, $message, $_POST["email"]);

header( "Location: daresubmitted.html");
?>

Link to comment
Share on other sites

Try this..

 

<?php
$name = $REQUEST['name'];
$place = $REQUEST["place"];
$dare = $REQUEST["dare"];
$email = $REQUEST["email"];

$to = 'dares@heyhitchhiker.com';
$subject = 'Hey, Hitchhiker!';
$headers = 'From: ' . $email . "\r\n";
$message = 'Someone called '.$name.' thinks you should go to '.$place.' for the purposes of '.$dare.'. You can get back to them at '.$email.'.';

mail($to, $subject, $message, $headers);
header( "Location: daresubmitted.html");

 

And the syntax error came from that if you copied timmahs code bcause he didnt have semicolon in the end of the line 4.

Link to comment
Share on other sites

Same result as it started with: sends the email with only the filler text.

try this , it should be $_REQUEST, you have $REQUEST

<?php
$name = $_REQUEST['name'];
$place = $_REQUEST["place"];
$dare = $_REQUEST["dare"];
$email = $_REQUEST["email"];

$to = 'dares@heyhitchhiker.com';
$subject = 'Hey, Hitchhiker!';
$headers = 'From: ' . $email . "\r\n";
$message = 'Someone called '.$name.' thinks you should go to '.$place.' for the purposes of '.$dare.'. You can get back to them at '.$email.'.';

mail($to, $subject, $message, $headers);
header( "Location: daresubmitted.html");

Link to comment
Share on other sites

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.