I’m rally novice to php and I need your help.
I’m crating a form and my server side scrip is given below. Kindly let me know how to validate it , what are methods I should used to validate, name, contact number and email ?
[php]
<?php //error code. error_reporting(E_ALL^E_NOTICE); $con=mysql_connect('localhost','root',''); mysql_select_db("ydms")or die(mysql_error()); if(isset($_POST['submit'])) { //$cust_id=$_POST[cust_id]; $cust_name=$_POST[cust_name]; $cust_shop_name=$_POST[cust_shop_name]; $cust_add_hnumber=$_POST[cust_add_hnumber]; $cust_add_line1=$_POST[cust_add_line1]; $cust_add_line2=$_POST[cust_add_line2]; $cust_add_city=$_POST[cust_add_city]; $cust_contact_name=$_POST[cust_contact_name]; $cust_contact1=$_POST[cust_contact1]; $cust_contact2=$_POST[cust_contact2]; $route_no=$_POST[route_no]; $state=$_POST[state]; $cust_remark=$_POST[cust_remark]; } // Applying validation rule //cust_id,'$cust_id', $sql=mysql_query ("INSERT INTO customer(cust_name,cust_shop_name,cust_add_hnumber,cust_add_line1,cust_add_line2,cust_add_city,cust_contact_name,cust_contact1,cust_contact2,route_no,state,cust_remark) VALUES('$cust_name','$cust_shop_name','$cust_add_hnumber','$cust_add_line1','$cust_add_line2','$cust_add_city','$cust_contact_name','$cust_contact1','$cust_contact2','$route_no','$state','$cust_remark')")or die(mysql_error()); if($sql){ echo "Successful"; } else { echo "ERROR"; } mysql_close($con); ?>[/php]
Please Please Please help me