Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

PHP Form Submission not working



5:19 am on Feb 11, 2014 (gmt 0)

I found the thread [webmasterworld.com...] for help but it is too old to ask a question.

I pretty much copied and fixed what people said in that thread but my form is still not submitting correctly.

Form Code:

<form action="result.php" method="post" enctype="text/plain" name="form1">
<table width="500" border="0" align="center" cellspacing="0">
<td><input name="name" type="text" size="30" maxlength="30"></td>
<td><input name="email" type="text" size="30" maxlength="50" placeholder="example@domain.com"></td>
<td><input name="phone" type="text" size="30" maxlength="20"></td>
<td>Inquiry type:</td>
<td><select name="type">
<option value="1" selected>Residential Inquiry</option>
<option value="2">Small Business Inquiry</option>
<option value="3">Web Design Inquiry</option>
<option value="4">Existing Client Inquiry</option>
<td><textarea name="message" cols="45" rows="5"></textarea></td>
<td><input name="submit" type="submit" value="Submit" />
<input name="reset" type="reset" value="Reset" /></td>

PHP Code:


$name = $_POST['name'];
$visitor_email = $_POST['email'];
$phone = $_POST['phone'];
$subject = $_POST['type'];
$message = $_POST['message'];

echo "Bad email value!";

$email_from = 'example@example.com';//<== update the email address
$email_subject = "$subject";
$email_body = "$message" + "phone";

$to = "example@example.com"; //<== update the email address
$headers = "From: $email_from \r\n";
$headers = "Reply-To: $visitor_email \r\n";
//Send the email!
//done. redirect to thank-you page.
header('Location: http://www.example.com/example.html');

// Function to validate against any email injection attempts
function IsInjected($str)
$injections = array('(\n+)',
$inject = join('|', $injections);
$inject = "/$inject/i";
return true;
return false;


When I hit submit on the web page it just directs to a blank page and I'm not getting an email sent where I designated it to send one.

Also should these two emails be two different emails or can they be the same?

$email_from = 'example@example.com';//<== update the email

$to = "example@example.com"; //<== update the email address


4:54 pm on Feb 11, 2014 (gmt 0)

I got it to work.


4:56 pm on Feb 11, 2014 (gmt 0)

I got it working, thanks anyway.


7:39 pm on Feb 11, 2014 (gmt 0)

WebmasterWorld Administrator coopster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

Welcome to WebmasterWorld, deceptionx.

Glad you got it sorted! What was the issue?

Featured Threads

Hot Threads This Week

Hot Threads This Month