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
Solved

HTML Form to PHP Email

Posted on 2013-06-30
4
529 Views
Last Modified: 2013-07-01
Hi

I am stuck with this one, i have gone through group by group on this PHP file but cannot seem to see where its stopping. i first done a simple contact form with a drop down and then a checkbox which worked but i dont know after adding the rest of the form inputs where the script stops.

attached are the 2 files that worked then i added the extra input forms.
test.html
test.php
0
Comment
Question by:Imran Shabir
  • 2
  • 2
4 Comments
 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 500 total points
ID: 39288598
Your first problem is that variable names including those in $_POST variables are case sensitive.  This the corrected version of this section.  Note that the variable name for $telephone didn't match the form name of 'PhoneNumber'.
	// validation expected data exists    
	if(!isset($_POST['FullName']) ||        
		!isset($_POST['Email']) ||        
		!isset($_POST['PhoneNumber'])) {        
		died('Sorry, there appears to be a problem with your form submission.');	          
	}

	// personal information
  $companyname = $_POST['CompanyName'];     
	$fullname = $_POST['FullName'];     
	$email_from = $_POST['Email'];     
	$telephone = $_POST['PhoneNumber'];

Open in new window

The second problem will be that you have not checked to see if the $_POST variables are set which will cause 'undefined index' errors.  This is how I normally do that.
if (!isset($_POST['Email']))  $email_from = ''; else $email_from = $_POST['Email'];

Open in new window

Third,  you need to give default values to the variables created from the $_POST variables which is also shown above.
0
 

Author Comment

by:Imran Shabir
ID: 39289172
Hi Dave

that worked like a charm and i received the email, i just need to match up all the rest $_POST's and play with it from there.

thanks for your quick response and help.
0
 

Author Closing Comment

by:Imran Shabir
ID: 39289175
quick response and very helpful
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 39289181
You're welcome, thanks for the points.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. 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.: (CODE)

808 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