Monday, June 8, 2015

Savedata to Database php code-User details form

if($id=='savedata')
{
$userid = $_GET['userid'];
$userno = $_GET['userno'];
$username = $_GET['username'];
$passwrd = md5($_GET['passwrd']);
$conpasswrd = $_GET['conpasswrd'];
$tite = $_GET['tite'];
$firstname = $_GET['firstname'];
$lastname = $_GET['lastname'];
$designation = $_GET['designation'];
$nic = $_GET['nic'];
$gender = $_GET['gender'];
$dateofbirth = $_GET['dateofbirth'];
$email = $_GET['email'];
$add1 = $_GET['add1'];
$add2 = $_GET['add2'];
$add3 = $_GET['add3'];
$tele = $_GET['tele'];

if($userid=="")
$sql="INSERT INTO user (username,email,password,intUserNo,strTitle,strFirst,strLast,strDesignation,strNic,strGender,dtmDate,strAdd1,strAdd2,strAdd3,intTele)  VALUES('$username','$email','$passwrd',$userno,'$tite','$firstname','$lastname','$designation','$nic','$gender',
'$dateofbirth','$add1','$add2','$add3',$tele)";
else
$sql="UPDATE user SET username='$username',email='$email',intUserNo=$userno,strTitle='$tite'
 ,strFirst='$firstname',strLast='$lastname',strDesignation='$designation',strNic='$nic',strGender='$gender',
 dtmDate='$dateofbirth',strAdd1='$add1',strAdd2='$add2',strAdd3='$add3',intTele=$tele  WHERE id='$userid' ";

$result=$db->RunQuery($sql);

if($result)
echo "Saved Successfully";
else
echo "Saving Failed";


}

No comments:

Post a Comment