View Full Version : email sending error

08-27-2009, 07:11 AM
i have this script but when i click on submit button it goes to the php file to send email. but it always reflect "blarg!" anyone know why?


<style type="text/css">

<script type="text/javascript" src="clientscript/vbulletin_md5.js?v=384"></script>
<script type="text/javascript">
function verify_names(name)
// do various checks, this will save people noticing mistakes on next page
if (name.value == '')
alert('Please fill out name fields.');
return false;
var junk_output;

md5hash(name1, document.forms.register.name_md5, junk_output, 0);

return true;
return false;

<form action="mailer1.php" name="register" method="post" onsubmit="return verify_names(name);">

<input type="hidden" name="name_md5" />

Name:<br />
<input type="text" name="name" size="25" />

<div style="margin-top:6px">
<input type="submit" class="button" value="submit"/>

<br />

php code

if(isset($_POST['submit'])) {

$to = "szething@pddesignstudio.com";
$subject = "CKC CONTACT FORM";
$headers = "From: ";
$headers .= $_POST['email'];

foreach($_POST['check'] as $value) {
$check_msg .= "Checked: $value\n";

$body = "Name: $name_field\n";

echo "Data has been submitted to $to!";
mail($to, $subject, $body, $headers);

} else {
echo "blarg!";

Phil Jackson
08-27-2009, 08:25 AM
look at this

} else {
echo "blarg!";

its outputting blarg due to the following statement is NOT true:

if(isset($_POST['submit'])) {


<input type="submit" class="button" value="submit"/>to
<input type="submit" class="button" name="submit" value="submit"/>

08-27-2009, 11:19 AM
You forgot the name tag to be set in your submit button.

PHP Developer

Phil Jackson
08-27-2009, 11:40 AM
... as stated previously