Page 1 of 1

error Notice: Undefined index:

Posted: Sat Aug 08, 2009 5:10 am
by rlb
I got error when run this script please try to help me

Code: Select all

<?php
$con=mysql_connect("localhost","root","");
if(!$con)
    {
    die('Could not connect:' . mysql_error());
    }
 
$ms = $_POST["ms"];
$wtr = $_POST["wtr"];
if (!$wtr){$wtr = 1;}
$wtc = $_POST["wtc"];
if (!$wtc){$wtc = 1;}
$wtinter = $_POST["wtinter"];
if (!$wtinter){$wtinter = 1;}
$wtrf = $_POST["wtrf"];
if (!$wtrf){$wtrf = 1;}
 
 
mysql_select_db("dbo",$con);
$sql="INSERT INTO 'emp' ('PFno', 'Name', 'Title', 'Address', 'Designation', 'Marital', 'NICNo', 'TPHome', 'TPMobile', 'CName', 'CAddress', 'CTPHome', 'CTPMobile', 'ApDatePS', 'ApletterNo', 'IncreDate', 'TranDateCurr', 'WTFO', 'TransFOffice', 'WConfirm', 'IncDate', 'ExamPro', 'Winter', 'InteraDate', 'WTrans', 'TranDate', 'TransTOffice') 
VALUES (
".$_POST['pfno']."',
'".$_POST['name']."','".$_POST['title']."','".$_POST['add']."','".$_POST['des']."','".$ms."','".$_POST['nic']."','".$_POST['tph']."','".$_POST['tpm']."','".$_POST['cname']."','".$_POST['cadd']."','".$_POST['ctpm']."','".$_POST['adateps']."','".$_POST['alno']."','".$_POST['incredate']."','".$_POST['tdatecur']."','".$wtr."','".$_POST['toff']."','".$wtc."','".$_POST['incredate2']."','".$wtinter."','".$_POST['incterdate']."','".$wtrf."','".$_POST['transferdate']."','".$_POST['transferoff']."'
 
 ;";
mysql_query($sql,$con);
 
 
mysql_close($con); 
echo "One record added";
?>

Re: error Notice: Undefined index:

Posted: Sat Aug 08, 2009 3:14 pm
by califdon
So what does the complete error say??????

Re: error Notice: Undefined index:

Posted: Sun Aug 09, 2009 3:03 am
by rlb
here is the complete error message and ms is to radio buttons and others to checkboxs
Notice: Undefined index: ms in D:\wamp\www\DBO\add.php on line 8

Notice: Undefined index: wtr in D:\wamp\www\DBO\add.php on line 9

Notice: Undefined index: wtc in D:\wamp\www\DBO\add.php on line 11

Notice: Undefined index: wtinter in D:\wamp\www\DBO\add.php on line 13

Notice: Undefined index: wtrf in D:\wamp\www\DBO\add.php on line 15
One record added