Solved

_POST not posting to my variables

Posted on 2010-09-01
2
263 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 500 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
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.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
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.

820 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