Solved

_POST not posting to my variables

Posted on 2010-09-01
2
264 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

CTAs encourage people to do something specific to show interest in your company, product or service. Keep reading to learn why CTAs should always be thought of as extremely important, albeit small, sections of websites.
Dramatic changes are revolutionizing how we build and use technology. Every company is automating, digitizing, and modernizing operations. We need a better, more connected way to work together as teams so we can harness the insights from our system…
This video teaches users how to migrate an existing Wordpress website to a new domain.
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.

739 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