Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

PHP Issue


  • Please log in to reply
4 replies to this topic

#1 MDTechService

MDTechService

  • Members
  • 303 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Maryland
  • Local time:02:41 AM

Posted 27 October 2012 - 09:32 PM

Ok, working on a contact page for a website. It is just a simple HTML form with PHP backside. For some reason, I am getting incomplete information (in the email) when I do a test submission.

This is where I'm at:

HTML Form:
<form action="contact.php" method="POST">
<p>Name</p> <input type="text" name="name" maxlength="40" />
<p>Email</p> <input type="text" name="email" />
<p>Location</p>
<select name="location" size="1">
	<option value="N.Amer">North America</option>
    <option value="S.Amer">South America</option>
    <option value="Europe">Europe</option>
    <option value="Asia">Asia</option>
    <option value="Aust/Pac">Australia/Pacific Island</option>
    <option value="Other">Other</option>
</select>
<br />
<p>Date</p> <input type="date" />
<br  />
<br />
<p><b>Why Are You Contacting Us?</b></p>
<select name="subject" size="1">
	<option value="support_general">General Game Support</option>
    <option value="support_urgent">Game Crashing/Not Working</option>
    <option value="game_feedback">Game Feedback</option>
    <option value="game_suggestion">Game Suggestion</option>
    <option value="web_support/suggestion">Web Support/Suggestion</option>
    <option value="other">Other</option>
</select>
<i>&nbsp;&nbsp;Select One</i>
<br />
<br />
<p>Message</p> <textarea name="message" rows="6" cols="60"></textarea>
<br />
<br />
  <input type="text" name="spam" size="1" maxlength="5" id="spam"/>
  <input type="submit" />
  <input type="reset" value="Clear"  />

</form>

PHP:
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$subject = $_POST['subject'];
$location = $_POST['location'];
$date = $_POST['date'];
$spam = $POST['spam'];
$message = $POST['message'];
$formcontent="From: On the date $date, the user $name has contacted you via the website's contact page. They are located in $location and would like to deliver the following message: \n $message";
$recipient= "mjdugan14@gmail.com";
$mailheader = "From: $email \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error, please re-submit your form!");
echo "Thank You!";
?>

I am not receiving the date or message itself, and I'm getting a bit brain fried as to why not. BTW, spam is just an invisible honeypot field.

Any help would be appreciated :)
If I am helping you and I haven't replied to your thread in 3 days, please PM me or bump it

Mike D, BS, A+, HPSP, MCTS
I <3 Linux
The Airline Open source airline simulation game
Check the power cable to the wall first!

BC AdBot (Login to Remove)

 


#2 Billy O'Neal

Billy O'Neal

    Visual C++ STL Maintainer


  • Malware Response Team
  • 12,304 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Redmond, Washington
  • Local time:12:41 AM

Posted 28 October 2012 - 02:31 AM

<input type="date" /> does not mean <input name="date" /> :) I'd try validating your HTML first before looking to the PHP as the cause.

As for message, you're missing an underscore: message = $_POST['message'];

Billy3
Twitter - My statements do not establish the official position of Microsoft Corporation, and are my own personal opinion. (But you already knew that, right?)
Posted Image

#3 MDTechService

MDTechService
  • Topic Starter

  • Members
  • 303 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Maryland
  • Local time:02:41 AM

Posted 28 October 2012 - 05:27 AM

Like I thought, a simple case of thinking about it too much. Thanks for the help :)
If I am helping you and I haven't replied to your thread in 3 days, please PM me or bump it

Mike D, BS, A+, HPSP, MCTS
I <3 Linux
The Airline Open source airline simulation game
Check the power cable to the wall first!

#4 Billy O'Neal

Billy O'Neal

    Visual C++ STL Maintainer


  • Malware Response Team
  • 12,304 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Redmond, Washington
  • Local time:12:41 AM

Posted 29 October 2012 - 11:47 AM

You're welcome :)

Billy3
Twitter - My statements do not establish the official position of Microsoft Corporation, and are my own personal opinion. (But you already knew that, right?)
Posted Image

#5 iceman85

iceman85

  • Members
  • 26 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:02:41 AM

Posted 25 January 2013 - 06:07 PM

<input type="date" /> does not mean <input name="date" /> :) I'd try validating your HTML first before looking to the PHP as the cause.

As for message, you're missing an underscore: message = $_POST['message'];

Billy3


Underscore also missing in $_POST['spam'] ;)

Edited by iceman85, 25 January 2013 - 06:08 PM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users