|
Posted by John on 11/04/45 11:48
> John wrote:
> > What's wrong with my
> > nice newbie-code? Here it is:
>
> Sjoerd <sjoerder@gmail.com> wrote:
> >This is wrong:
> > if(strcmp($_POST['check'],"") !="yes"))
>
> These are correct:
> if (0 == strcmp($_POST['check'], "yes"))
> if ($_POST['check'] == "yes")
> if (empty($_POST['check'])
>
I tried to rewrite the process.php and also add another checkbox to be
cheked, but still something is wrong. Here is the code, can you see the
error in the code?
<?php
//check if secret code is not filled in and if checkbox are not cheked
if (empty($_POST['secret_code']) && (empty($_POST['check']))
//is so then exit
{
exit();
}
//check if secret code are submitted and if it matches
if (strcmp($_POST['secret_code'],"SECRET"))
//check if checkbox are cheked "yes"
//and if checkbox 2 are cheked "yes"
if (0 == strcmp($_POST['check'], "yes"))
if (0 == strcmp($_POST['check2'], "yes"))
if ($_POST['check'] == "yes") && ($_POST['check2'] == "yes")
//then start the mailing process
{
$do = ($_POST['do']);
if($do == "send")
{
$recipient = "secret_mail@somedomain.com";
$subject = ($_POST['subject']);
$name = ($_POST['name']);
$email = ($_POST['email']);
$message = ($_POST['message']);
$formsend = mail("$recipient", "$subject", "$message", "From: $email
($name)\r\nReply-to:$email");
echo ("<p>Thanks, sucess!</p>");
}
}
else
{
echo "You failed to enter secret code, submit cancelled...";
}
}
?>
Navigation:
[Reply to this message]
|