Solved

HTML Form to PHP Email

Posted on 2013-06-30
4
525 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This article discusses four methods for overlaying images in a container on a web page
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
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)
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

912 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now