Link to home
Start Free TrialLog in
Avatar of Henry Starcher
Henry StarcherFlag for United States of America

asked on

PHP Form not filling in header info

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

ASKER CERTIFIED SOLUTION
Avatar of ziceva
ziceva
Flag of Romania image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Henry Starcher

ASKER

Awesome. I knew it was something simple! Thanks for the quick reply.