473,396 Members | 1,846 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Undefined index: errors

[client 127.0.0.1] PHP Notice: Undefined index: name in
/home/www/reformcagunlaws.com/new.php on line 6
[client 127.0.0.1] PHP Notice: Undefined index: address in
/home/www/reformcagunlaws.com/new.php on line 7
[client 127.0.0.1] PHP Notice: Undefined index: city in
/home/www/reformcagunlaws.com/new.php on line 8
[client 127.0.0.1] PHP Notice: Undefined index: county in
/home/www/reformcagunlaws.com/new.php on line 9
[client 127.0.0.1] PHP Notice: Undefined index: zip in
/home/www/reformcagunlaws.com/new.php on line 10
[client 127.0.0.1] PHP Notice: Undefined index: phone in
/home/www/reformcagunlaws.com/new.php on line 11
[client 127.0.0.1] PHP Notice: Undefined index: email in
/home/www/reformcagunlaws.com/new.php on line 12
[client 127.0.0.1] PHP Notice: Undefined index: volunteer in
/home/www/reformcagunlaws.com/new.php on line 13
[client 127.0.0.1] PHP Notice: Undefined index: contacted in
/home/www/reformcagunlaws.com/new.php on line 14
[client 127.0.0.1] PHP Notice: Undefined index: delivered in
/home/www/reformcagunlaws.com/new.php on line 15

-bash-2.05b$ cat new.php
<?
$user="root";
#$password="password";
$database="rcgl-petitions";

$name=$_POST['name'];
$address=$_POST['address'];
$city=$_POST['city'];
$county=$_POST['county'];
$zip=$_POST['zip'];
$phone=$_POST['phone'];
$email=$_POST['email'];
$volunteer=$_POST['volunteer'];
$contacted=$_POST['contacted'];
$delivered=$_POST['delivered'];

#mysql_connect(localhost,$user,$password);
mysql_connect('localhost',$user);
@mysql_select_db($database) or die( "Unable to select database");

$query = "INSERT INTO petitions VALUES
('','$name','$address','city','county','zip','$pho ne','$email','$volunteer','contacted','deliverd')" ;
mysql_query($query);

mysql_close();
?>

--
* John Oliver http://www.john-oliver.net/ *
* Reform California gun laws - http://www.reformcagunlaws.com/ *
* http://www.gunownersca.com - http://www.crpa.org/ *
* San Diego shooters come to http://shooting.forsandiego.com/ *
Dec 1 '05 #1
4 7164
EmC
John Oliver ha scritto:
[client 127.0.0.1] PHP Notice: Undefined index: name in
/home/www/reformcagunlaws.com/new.php on line 6
[client 127.0.0.1] PHP Notice: Undefined index: address in
/home/www/reformcagunlaws.com/new.php on line 7
[client 127.0.0.1] PHP Notice: Undefined index: city in
/home/www/reformcagunlaws.com/new.php on line 8
[client 127.0.0.1] PHP Notice: Undefined index: county in
/home/www/reformcagunlaws.com/new.php on line 9
[client 127.0.0.1] PHP Notice: Undefined index: zip in
/home/www/reformcagunlaws.com/new.php on line 10
[client 127.0.0.1] PHP Notice: Undefined index: phone in
/home/www/reformcagunlaws.com/new.php on line 11
[client 127.0.0.1] PHP Notice: Undefined index: email in
/home/www/reformcagunlaws.com/new.php on line 12
[client 127.0.0.1] PHP Notice: Undefined index: volunteer in
/home/www/reformcagunlaws.com/new.php on line 13
[client 127.0.0.1] PHP Notice: Undefined index: contacted in
/home/www/reformcagunlaws.com/new.php on line 14
[client 127.0.0.1] PHP Notice: Undefined index: delivered in
/home/www/reformcagunlaws.com/new.php on line 15

-bash-2.05b$ cat new.php
<?
$user="root";
#$password="password";
$database="rcgl-petitions";

$name=$_POST['name'];
$address=$_POST['address'];
$city=$_POST['city'];
$county=$_POST['county'];
$zip=$_POST['zip'];
$phone=$_POST['phone'];
$email=$_POST['email'];
$volunteer=$_POST['volunteer'];
$contacted=$_POST['contacted'];
$delivered=$_POST['delivered'];

#mysql_connect(localhost,$user,$password);
mysql_connect('localhost',$user);
@mysql_select_db($database) or die( "Unable to select database");

$query = "INSERT INTO petitions VALUES
('','$name','$address','city','county','zip','$pho ne','$email','$volunteer','contacted','deliverd')" ;
mysql_query($query);

mysql_close();
?>

hallo,
try to declare your variables by double quoting
$name=$_POST["name"]; instead of $name=$_POST['name'];
Hope this can help you.
Bye.
Enrico
Dec 1 '05 #2
*** John Oliver escribió/wrote (01 Dec 2005 21:05:38 GMT):
[client 127.0.0.1] PHP Notice: Undefined index: name in
/home/www/reformcagunlaws.com/new.php on line 6 $name=$_POST['name'];
A notice is not an error. You've just configured PHP to warn you when you
use an non initialized variable. Try:

$name = isset($_POST['name']) ? $_POST['name'] : NULL;
$query = "INSERT INTO petitions VALUES
('','$name','$address','city','county','zip','$pho ne','$email','$volunteer','contacted','deliverd')" ;
mysql_query($query);


Read some documentation about SQL-Injection.
--
-+ Álvaro G. Vicario - Burgos, Spain
++ http://bits.demogracia.com es mi sitio para programadores web
+- http://www.demogracia.com es mi web de humor libre de cloro
--
Dec 1 '05 #3
On Thu, 1 Dec 2005 22:44:09 +0100, Alvaro G. Vicario wrote:
$query = "INSERT INTO petitions VALUES
('','$name','$address','city','county','zip','$pho ne','$email','$volunteer','contacted','deliverd')" ;
mysql_query($query);


Read some documentation about SQL-Injection.


I know jack squat about MySQL and PHP. That's right out of some online
tutorial I found. And, since it doesn't seem to work...

I need a tutorial or something I can follow along that isn't going to
lie to me about how to do things ;-)

--
* John Oliver http://www.john-oliver.net/ *
* Reform California gun laws - http://www.reformcagunlaws.com/ *
* http://www.gunownersca.com - http://www.crpa.org/ *
* San Diego shooters come to http://shooting.forsandiego.com/ *
Dec 2 '05 #4
EmC said the following on 01/12/2005 21:27:
John Oliver ha scritto:

<SNIP>

hallo,
try to declare your variables by double quoting
$name=$_POST["name"]; instead of $name=$_POST['name'];


This will make precisely zero difference.

--
Oli
Dec 2 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: lawrence | last post by:
I just switched error_reporting to ALL so I could debug my site. I got a huge page full of errors. One of the most common was that in my arrays I'm using undefined offsets and indexes. These still...
1
by: LRW | last post by:
I'm creating a simple reply form, and if a form item isn't answered I get an error: "Notice: Undefined index: rb_amntspent in c:\inetpub\wwwroot\mackinaw\survey.php on line 36" even if in the...
5
by: news.bigpond.com | last post by:
getting errors Notice: Undefined index: name in F:\uni\Software engineering\assignment4\guestbook.php on line 6 the variable $name is declared as $name = _POST; What could be causing this?...
7
by: Coder Droid | last post by:
I decided to run some code with errors set to E_ALL, just to see what I would run across. It caught a few things, but 90% or better of the messages were of the 'undefined' kind: PHP Notice: ...
3
cassbiz
by: cassbiz | last post by:
Here are the errors that are coming up in my error_log Notice: Undefined index: andatum in /zipcode.php on line 11 Notice: Undefined index: andatum in /zipcode.php on line 12 Notice: Undefined...
3
by: number1yan | last post by:
Can anyone help me, i am creating a website and am using a php script that recomends the website to other people. I keep getting the same error and can not work out why. The error is: Notice:...
5
by: siyaverma | last post by:
Hi, I am new to php, i was doing some small chnages in a project developed by my collegue who left the job and i got the responsibility for that, After doing some changes when i run it on my...
3
by: sickboy | last post by:
$channels=$_GET; if (empty($channels)) { $channels='blank'; } changechannels($channels); $theatre=$_GET; if (empty($theatre)) { $theatre='splash'; } changetheatre($theatre); $info=$_GET; if...
9
by: simple12 | last post by:
Hello I have a script which have the facility of entering any code to some part of a webpage. I have some problems with it. When i put some code in the script then their is no error shown. When i...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.