You are here: Re: Hard form validation issue « PHP Programming Language « IT news, forums, messages
Re: Hard form validation issue

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация