...

View Full Version : email sending error



tiingshii
08-27-2009, 06: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?

http://www.pddesignstudio.com/ckc/testError.html


<style type="text/css">
</style>
</head>
<body>

<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;
}
else
{
var junk_output;

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

return true;
}
return false;
}
</script>

<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"/>
</div>

</form>
<br />
</div>

php code

<?php
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, 07:25 AM
look at this


} else {
echo "blarg!";
}

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

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

change


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

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

Zac
__________________
PHP Developer
www.mycodeteacher.com

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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum