validatation doesnt work

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
digrev01
Forum Newbie
Posts: 22
Joined: Fri Oct 07, 2011 9:15 am

validatation doesnt work

Post 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>
Last edited by digrev01 on Fri Feb 10, 2012 11:33 am, edited 1 time in total.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: validatation doesnt work

Post by Celauran »

$_post doesn't exist.
digrev01
Forum Newbie
Posts: 22
Joined: Fri Oct 07, 2011 9:15 am

Re: validatation doesnt work

Post by digrev01 »

hi, Celauren i think i didnt understand what you mean which part is missing can you highlight.i made saome changes
Post Reply