Solved

HTML Form to PHP Email

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

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 82

Expert Comment

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

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
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…

757 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

22 Experts available now in Live!

Get 1:1 Help Now