error Notice: Undefined index:

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
rlb
Forum Newbie
Posts: 2
Joined: Sat Aug 08, 2009 5:08 am

error Notice: Undefined index:

Post 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";
?>
Last edited by califdon on Sat Aug 08, 2009 3:13 pm, edited 2 times in total.
Reason: Moderator added [php] code tags to make the code readable. Poster, please learn to do this yourself in the future. Thank you.
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: error Notice: Undefined index:

Post by califdon »

So what does the complete error say??????
rlb
Forum Newbie
Posts: 2
Joined: Sat Aug 08, 2009 5:08 am

Re: error Notice: Undefined index:

Post 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
Post Reply