homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

PHP Form Submission not working

Msg#: 4644103 posted 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



Msg#: 4644103 posted 4:54 pm on Feb 11, 2014 (gmt 0)

I got it to work.


Msg#: 4644103 posted 4:56 pm on Feb 11, 2014 (gmt 0)

I got it working, thanks anyway.


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

Msg#: 4644103 posted 7:39 pm on Feb 11, 2014 (gmt 0)

Welcome to WebmasterWorld, deceptionx.

Glad you got it sorted! What was the issue?

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved