Page 1 of 1

validatation doesnt work

Posted: Thu Feb 09, 2012 2:58 pm
by digrev01
hi everybody ,in my form i want chechk if the all fields are filled .but i think something is wrong because i dont get any error messages like plase fill all the fields or

Code: Select all


<?php


if(mysql_connect("localhost","root","") && mysql_select_db("guestbook"))
{
                   $time=time();
                   $error=array();
                       if(isset($_POST['g_name'], $_POST['g_mail'],$_POST['g_message']))
{


$name=$_POST['g_name'];
$email=$_POST['g_mail'];
$message=$_POST['g_message'];

                      if(empty($name) || empty($email) || empty($message))
{
$error[]= "all fields are requried";
}

else
{
echo "  thanks dude ";

}


}
}


else
{
echo"coulndt connect ";
}
?>
<form action="<?php echo htmlentities($_SERVER['PHP_SELF']);?>" method="POST">
<strong>Post Something...</strong><br>

Name :<br>
<input name="g_name" type="text" maxlength="25"><br>
Email :<br>
<input name="g_mail" type="text" maxlength="255"><br>
Message:<br>
<textarea name="g_message" cols="30" rows="6"></textarea>
<input  type="submit" value="post">

</form>

Re: validatation doesnt work

Posted: Thu Feb 09, 2012 3:11 pm
by Celauran
$_post doesn't exist.

Re: validatation doesnt work

Posted: Fri Feb 10, 2012 8:58 am
by digrev01
hi, Celauren i think i didnt understand what you mean which part is missing can you highlight.i made saome changes