Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

_POST not posting to my variables

Posted on 2010-09-01
2
Medium Priority
?
268 Views
Last Modified: 2012-05-10
Guys,

I don't understand whats wrong here, this is almost a complete copy from an original working form i had before and this thing is shooting me emails with my message but not including the values for my fields. For example it's giving me Name: .... Email: ..... Comments: .....

This is my HTML Form, and everything works fine:

 
<form id="contacts" method="post" enctype="multipart/form-data" action="include/inc_sendmail.php">

                            <input tabindex="1" type="text" id="visitor" name="name" value="Name" onfocus="if (this.value=='Name') this.value='';" onblur="if (this.value=='') this.value='Name';" class="required name" minlength="5" />
                          <br />
                                
                                <input tabindex="2" type="text" id="visitormail" name="email" value="E-mail" onfocus="if (this.value=='E-mail') this.value='';" onblur="if (this.value=='') this.value='E-mail';" class="required email" />
                                <br />

                                
                                <textarea tabindex="3" id="notes" name="comment" cols="30" rows="3" onfocus="if (this.value=='Message') this.value='';" onblur="if (this.value=='') this.value='Message';" class="required" minlength="10">Message</textarea>
                                <br />

                            	<input class="button" name="Send" value="Send e-mail" type="submit" />
                            	
                        	</fieldset>
                        </form>

Open in new window



Here is my "working" php file:


 
<?php

ini_set("sendmail_from", "xxxxx@gmail.com");


$name = $_POST['visitor'];
$email = $_POST['visitormail'];
$comment = $_POST['notes'];
$from = $email;

$message = "Name: $name \n\n Email: $email \n\n Comments: $comment\n\n";



if (!@mail("xxxxx@gmail.com","Portfolio Contact", $message,"From: $from\nContent-Type: text/html; charset=iso-8859-1")) {
	echo "<script language='javascript'>alert('There have been some problems sending the email');</script>"
	."<meta http-equiv='refresh' content='0;url=../index.html'>";
	
} else {
	echo "<script language='javascript'>alert('Thank you for contacting me');</script>"
	."<meta http-equiv='refresh' content='0;url=../index.html'>";
}
?>

Open in new window



Anyone see anything obvious i'm missing here?
0
Comment
Question by:Arka3L
2 Comments
 
LVL 2

Accepted Solution

by:
IngCharlie earned 2000 total points
ID: 33579664
Name and Id must have the same value



<form id="contacts" method="post" enctype="multipart/form-data" action="include/inc_sendmail.php">

                            <input tabindex="1" type="text" id="visitor" name="visitor" value="Name" onfocus="if (this.value=='Name') this.value='';" onblur="if (this.value=='') this.value='Name';" class="required name" minlength="5" />
                          <br />
                               
                                <input tabindex="2" type="text" id="visitormail" name="visitormail" value="E-mail" onfocus="if (this.value=='E-mail') this.value='';" onblur="if (this.value=='') this.value='E-mail';" class="required email" />
                                <br />

                               
                                <textarea tabindex="3" id="notes" name="notes" cols="30" rows="3" onfocus="if (this.value=='Message') this.value='';" onblur="if (this.value=='') this.value='Message';" class="required" minlength="10">Message</textarea>
                                <br />

                                  <input class="button" name="Send" value="Send e-mail" type="submit" />
                                  
                              </fieldset>
                        </form>
0
 
LVL 1

Author Closing Comment

by:Arka3L
ID: 33579694
Interesting, i had no idea! That fixed it.

thanks again for the prompt answer :D
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.
Suggested Courses

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question