[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

PHP Form not filling in header info

Posted on 2011-10-13
2
Medium Priority
?
353 Views
Last Modified: 2013-12-13
I have the following codes for a simple contact email form. The forms get sent correctly, however none of the header info is included. No sent from, subject and so on. Can someone take a look at tell me what is wrong?

Thanks!
<?php 

	$to = 'info@hcscomputersolutions.com';
	$subject = $_POST['inquiryOptions'];
	$header = $_POST['emailAddress'];
	$message = "From: $fullName\nBusiness Name: $businessName\nSender e-mail address: $header\nSender phone number: $phoneNumber\nPreferred method of contact: $contact\nRegarding: $subject\n\nMessage:\n$comment\n";

if ($header==" ") {
echo "<meta http-equiv=\"refresh\" content=\"0;URL=error.html\">";
exit;
}

$success = mail ($to, $subject, $message, "From: <$header>");

if ($success){
echo "<meta http-equiv=\"refresh\" content=\"0;URL=success.html\">";
}
else {
echo "<meta http-equiv=\"refresh\" content=\"0;URL=failure.html\">";
}

 ?>

Open in new window

<form action="emailProcessor.php">
	<table>
		<tr>
			<td>Name:</td>
			<td><input name="fullName" size="30" tabindex="1" type="text" /></td>
		</tr>
		<tr>
			<td>Business Name:</td>
			<td><input name="businessName" size="30" tabindex="2" type="text" />&nbsp;</td>
		</tr>
		<tr>
			<td>Phone Number:</td>
			<td><input name="phoneNumber" size="30" tabindex="3" type="text" /></td>
		</tr>
		<tr>
			<td style="height: 29px">E-mail Address:</td>
			<td style="height: 29px"><input name="emailAddress" size="30" tabindex="4" type="text" /></td>
		</tr>
		<tr>
			<td>Preferred Method of Contact:</td>
			<td>
			<select name="contact" tabindex="5">
			<option selected="selected">Phone</option>
			<option>E-mail</option>
			</select></td>
		</tr>
		<tr>
			<td>Type of Inquiry:</td>
			<td><select name="inquiryOptions" tabindex="6">
			<option selected="selected">Technical Question</option>
			<option>Product Question</option>
			<option>Service Question</option>
			<option>Other</option>
			</select>&nbsp;</td>
		</tr>
		<tr>
			<td>What's on your mind?</td>
			<td><textarea cols="70" name="comment" rows="8" tabindex="7"></textarea></td>
		</tr>
		<tr>
			<td>&nbsp;</td>
			<td>
			<input name="submit" tabindex="8" type="submit" value="Submit" />&nbsp;
			<input name="reset" tabindex="9" type="reset" value="Reset" /></td>
		</tr>
	</table>

</form>

Open in new window

0
Comment
Question by:warsawtech
2 Comments
 
LVL 7

Accepted Solution

by:
ziceva earned 500 total points
ID: 36965137
Replace

<form action="emailProcessor.php">

with

<form action="emailProcessor.php" method="post">

By default, the method is GET, so nothing in POST to read ...


0
 
LVL 2

Author Closing Comment

by:warsawtech
ID: 36965196
Awesome. I knew it was something simple! Thanks for the quick reply.
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

Rules and regulations were devised in order to maintain the integrity of a system. However, interpretation of rules can be quite tricky.
Web hosting control panels were first developed to make it faster and easier for most users to set up and operate websites. The graphical user interface (GUI) allows users to perform tasks by pointing and clicking rather than typing highly specific…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Suggested Courses
Course of the Month19 days, 14 hours left to enroll

873 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