Solved

HTML Form to PHP Email

Posted on 2013-06-30
4
531 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
[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
  • 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

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

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.
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

734 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