By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,890 Members | 1,048 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,890 IT Pros & Developers. It's quick & easy.

error...

P: n/a
mac
hi,
im new to php.can anybody please tell waht tis error is....

Notice: Undefined index: empname in d:\instantrails\www\test\new
\formsubmit.php on line 14
thanx
mac
Sep 9 '08 #1
Share this Question
Share on Google+
7 Replies


P: n/a
mac wrote:
hi,
im new to php.can anybody please tell waht tis error is....

Notice: Undefined index: empname in d:\instantrails\www\test\new
\formsubmit.php on line 14
thanx
mac
You didn't show any code, so it's impossible to tell you exactly.
However, it means you are trying to access an element of an array which
doesn't exist, i.e. you are trying to get the value of
$my_array['empname'], but never set it.

You can check to see if a value has been set with isset().

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Sep 9 '08 #2

P: n/a
mac
On Sep 9, 4:04*am, Jerry Stuckle <jstuck...@attglobal.netwrote:
mac wrote:
hi,
* * im new to php.can anybody please tell waht tis error is....
Notice: Undefined index: empname in d:\instantrails\www\test\new
\formsubmit.php on line 14
thanx
mac

You didn't show any code, so it's impossible to tell you exactly.
However, it means you are trying to access an element of an array which
doesn't exist, i.e. you are trying to get the value of
$my_array['empname'], but never set it.

You can check to see if a value has been set with isset().

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================
hi,
this is some code...
<?php
include("conn.php");
$mode=$_REQUEST["mode"];
if($mode=="add") {
$empname=$_REQUEST["empname"];
$age=$_REQUEST["age"];
$designation=$_REQUEST["designation"];
$salary=$_REQUEST["salary"];
$state=$_REQUEST["state"];
$city=$_REQUEST["city"];

$sql="insert into
emp(empname,age,designation,salary,state,city)
values('$empname','$age','$designation','$salary', '$state','$city')";
$result=mysql_query($sql,$connection) or
die(mysql_error());


header("location: index.php");

--------------------------
------------------
Sep 9 '08 #3

P: n/a
Message-ID:
<b3**********************************@z11g2000prl. googlegroups.comfrom
mac contained the following:
include("conn.php");
$mode=$_REQUEST["mode"];
if($mode=="add") {
$empname=$_REQUEST["empname"];
$age=$_REQUEST["age"];
$designation=$_REQUEST["designation"];
$salary=$_REQUEST["salary"];
$state=$_REQUEST["state"];
$city=$_REQUEST["city"];

$sql="insert into
emp(empname,age,designation,salary,state,city)
values('$empname','$age','$designation','$salary' ,'$state','$city')";
$result=mysql_query($sql,$connection) or
die(mysql_error());
The notice may be the least of your problems.

See http://www.tizag.com/mysqlTutorial/m...-injection.php
--
Geoff Berrow 0110001001101100010000000110
001101101011011001000110111101100111001011
100110001101101111001011100111010101101011
http://slipperyhill.co.uk - http://4theweb.co.uk
Sep 9 '08 #4

P: n/a
mac wrote:
On Sep 9, 4:04 am, Jerry Stuckle <jstuck...@attglobal.netwrote:
>mac wrote:
>>hi,
im new to php.can anybody please tell waht tis error is....
Notice: Undefined index: empname in d:\instantrails\www\test\new
\formsubmit.php on line 14
thanx
mac
You didn't show any code, so it's impossible to tell you exactly.
However, it means you are trying to access an element of an array which
doesn't exist, i.e. you are trying to get the value of
$my_array['empname'], but never set it.

You can check to see if a value has been set with isset().

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================

hi,
this is some code...
<?php
include("conn.php");
$mode=$_REQUEST["mode"];
if($mode=="add") {
$empname=$_REQUEST["empname"];
$age=$_REQUEST["age"];
$designation=$_REQUEST["designation"];
$salary=$_REQUEST["salary"];
$state=$_REQUEST["state"];
$city=$_REQUEST["city"];

$sql="insert into
emp(empname,age,designation,salary,state,city)
values('$empname','$age','$designation','$salary', '$state','$city')";
$result=mysql_query($sql,$connection) or
die(mysql_error());


header("location: index.php");

--------------------------
------------------
It means that $_REQUEST['empname'] is not set. This should have
probably come from a form posted to this page.

Before attempting to use the value, you should check to see if it is
set, with

if (isset($_REQUEST['empname'])) { ...

And also - you shouldn't be using $_REQUEST. Rather, use $_POST or
$_GET, depending on whether the form method is GET or POST. $_REQUEST
will check either, but will also check $_COOKIE - which will cause you
problems if you ever set a cookie for empname. No, I'm sure you aren't
planning to do so now - but what about six months from now? This just
leaves another door open for a bug.

And as Geoff said - study up on SQL injection. If you don't understand
it and watch for it, a hacker can do almost anything he wants to your
database - including wiping it out.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Sep 9 '08 #5

P: n/a
mac
On Sep 9, 10:43*am, Jerry Stuckle <jstuck...@attglobal.netwrote:
mac wrote:
On Sep 9, 4:04 am, Jerry Stuckle <jstuck...@attglobal.netwrote:
mac wrote:
hi,
* * im new to php.can anybody please tell waht tis error is....
Notice: Undefined index: empname in d:\instantrails\www\test\new
\formsubmit.php on line 14
thanx
mac
You didn't show any code, so it's impossible to tell you exactly.
However, it means you are trying to access an element of an array which
doesn't exist, i.e. you are trying to get the value of
$my_array['empname'], but never set it.
You can check to see if a value has been set with isset().
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================
hi,
this is some code...
<?php
* * * * * include("conn.php");
* * * * * $mode=$_REQUEST["mode"];
* * * * * if($mode=="add") {
* * * * * * $empname=$_REQUEST["empname"];
* * * * * * $age=$_REQUEST["age"];
* * * * * * $designation=$_REQUEST["designation"];
* * * * * * $salary=$_REQUEST["salary"];
* * * * * * $state=$_REQUEST["state"];
* * * * * * $city=$_REQUEST["city"];
* * * * * * $sql="insert into
emp(empname,age,designation,salary,state,city)
values('$empname','$age','$designation','$salary', '$state','$city')";
* * * * * * $result=mysql_query($sql,$connection) or
die(mysql_error());
* * * * * * * header("location: index.php");
* * * * * * * --------------------------
------------------

It means that $_REQUEST['empname'] is not set. *This should have
probably come from a form posted to this page.

Before attempting to use the value, you should check to see if it is
set, with

* *if (isset($_REQUEST['empname'])) { ...

And also - you shouldn't be using $_REQUEST. *Rather, use $_POST or
$_GET, depending on whether the form method is GET or POST. *$_REQUEST
will check either, but will also check $_COOKIE - which will cause you
problems if you ever set a cookie for empname. *No, I'm sure you aren't
planning to do so now - but what about six months from now? *This just
leaves another door open for a bug.

And as Geoff said - study up on SQL injection. *If you don't understand
it and watch for it, a hacker can do almost anything he wants to your
database - including wiping it out.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================- Hide quoted text -

- Show quoted text -
hi,
thnks a lot...the prblm got solved.
mac
Sep 10 '08 #6

P: n/a
mac
On Sep 9, 10:43*am, Jerry Stuckle <jstuck...@attglobal.netwrote:
mac wrote:
On Sep 9, 4:04 am, Jerry Stuckle <jstuck...@attglobal.netwrote:
mac wrote:
hi,
* * im new to php.can anybody please tell waht tis error is....
Notice: Undefined index: empname in d:\instantrails\www\test\new
\formsubmit.php on line 14
thanx
mac
You didn't show any code, so it's impossible to tell you exactly.
However, it means you are trying to access an element of an array which
doesn't exist, i.e. you are trying to get the value of
$my_array['empname'], but never set it.
You can check to see if a value has been set with isset().
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================
hi,
this is some code...
<?php
* * * * * include("conn.php");
* * * * * $mode=$_REQUEST["mode"];
* * * * * if($mode=="add") {
* * * * * * $empname=$_REQUEST["empname"];
* * * * * * $age=$_REQUEST["age"];
* * * * * * $designation=$_REQUEST["designation"];
* * * * * * $salary=$_REQUEST["salary"];
* * * * * * $state=$_REQUEST["state"];
* * * * * * $city=$_REQUEST["city"];
* * * * * * $sql="insert into
emp(empname,age,designation,salary,state,city)
values('$empname','$age','$designation','$salary', '$state','$city')";
* * * * * * $result=mysql_query($sql,$connection) or
die(mysql_error());
* * * * * * * header("location: index.php");
* * * * * * * --------------------------
------------------

It means that $_REQUEST['empname'] is not set. *This should have
probably come from a form posted to this page.

Before attempting to use the value, you should check to see if it is
set, with

* *if (isset($_REQUEST['empname'])) { ...

And also - you shouldn't be using $_REQUEST. *Rather, use $_POST or
$_GET, depending on whether the form method is GET or POST. *$_REQUEST
will check either, but will also check $_COOKIE - which will cause you
problems if you ever set a cookie for empname. *No, I'm sure you aren't
planning to do so now - but what about six months from now? *This just
leaves another door open for a bug.

And as Geoff said - study up on SQL injection. *If you don't understand
it and watch for it, a hacker can do almost anything he wants to your
database - including wiping it out.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================- Hide quoted text -

- Show quoted text -
in my form i have 2 comboboxes viz state and city,,,,if i select
state automatically only those cities shud wich come under that
perticular state.. in city combobox... hw to do any idea abt html
select tag?
mac
Sep 10 '08 #7

P: n/a
mac wrote:
On Sep 9, 10:43 am, Jerry Stuckle <jstuck...@attglobal.netwrote:
>mac wrote:
>>On Sep 9, 4:04 am, Jerry Stuckle <jstuck...@attglobal.netwrote:
mac wrote:
hi,
im new to php.can anybody please tell waht tis error is....
Notice: Undefined index: empname in d:\instantrails\www\test\new
\formsubmit.php on line 14
thanx
mac
You didn't show any code, so it's impossible to tell you exactly.
However, it means you are trying to access an element of an array which
doesn't exist, i.e. you are trying to get the value of
$my_array['empname'], but never set it.
You can check to see if a value has been set with isset().

hi,
this is some code...
<?php
include("conn.php");
$mode=$_REQUEST["mode"];
if($mode=="add") {
$empname=$_REQUEST["empname"];
$age=$_REQUEST["age"];
$designation=$_REQUEST["designation"];
$salary=$_REQUEST["salary"];
$state=$_REQUEST["state"];
$city=$_REQUEST["city"];
$sql="insert into
emp(empname,age,designation,salary,state,city)
values('$empname','$age','$designation','$salary ','$state','$city')";
$result=mysql_query($sql,$connection) or
die(mysql_error());
header("location: index.php");
--------------------------
------------------
It means that $_REQUEST['empname'] is not set. This should have
probably come from a form posted to this page.

Before attempting to use the value, you should check to see if it is
set, with

if (isset($_REQUEST['empname'])) { ...

And also - you shouldn't be using $_REQUEST. Rather, use $_POST or
$_GET, depending on whether the form method is GET or POST. $_REQUEST
will check either, but will also check $_COOKIE - which will cause you
problems if you ever set a cookie for empname. No, I'm sure you aren't
planning to do so now - but what about six months from now? This just
leaves another door open for a bug.

And as Geoff said - study up on SQL injection. If you don't understand
it and watch for it, a hacker can do almost anything he wants to your
database - including wiping it out.

in my form i have 2 comboboxes viz state and city,,,,if i select
state automatically only those cities shud wich come under that
perticular state.. in city combobox... hw to do any idea abt html
select tag?
mac
I believe you're looking for JavaScript help, in this case, not PHP.
Try comp.lang.javascript.

--
Curtis
Sep 10 '08 #8

This discussion thread is closed

Replies have been disabled for this discussion.