Solved

HTML Form to PHP Email

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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
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 how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

763 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