473,902 Members | 3,407 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Undefined Index notices

I'm getting this:

[client 192.168.5.50] PHP Notice: Undefined index: D1 in
/var/www/html.....

From this line of code:

$id_option = $_POST['D1'];

Which is posted by this:

<form target="_blank" method="POST" action="mailcha rt.php" name="mail_data ">
<input type="hidden" name="D1" value="<? echo $id_option; ?>">
<input type="submit" value="View Chart"></p>
</form>

My question is why?

I *am* getting the correct value for $_POST['D1'] and at this point in
time am really quite confused because that notice is getting thrown.

[root@... ~]# php -v
PHP 4.3.11 (cgi) (built: Nov 8 2005 06:24:40)

[root@... /]# uname -a
Linux ... 2.6.12-2.3.legacy_FC3 #1 Sun Feb 19 10:47:10 EST 2006 i686
i686 i386 GNU/Linux

Thanks..

Craig
Jun 8 '06
26 3768
Markus Ernst wrote:
Craig Morrison schrieb:

[...]
Why don't you just say that you don't know?

Or is it that you just feel a need to be verbose for no reason?

Here is the entire mess of code.. You tell me why the notice is thrown
if you can, otherwise shut the fuck up.
You might understand that people will not take their time to answer your
questions if you stick to this style of posting.


It doesn't make people shut up either. :)

To be fair, his original post was quite polite.

Also keep in mind that
newsgroups are archieved by Google, and thus everything you write will
be accessible in the future for anybody having any interests about your
personality, i.e. recruiters of companies where you apply for a job.

http://groups.google.ch/groups/profi...DuwKz324rebT9g shows that you are quite new to newsgroups; you might want to read some
pages on netiquette. (I remember to have made some postings I am not
proud of when I first started to post to newsgroups, so I know what I
write about.)
When going head first into a mass of people from widely different cultures,
many trying to convey their message in a foreign language, then I think
some initial conflicts is what can be expected, regardless of the person.

And people change. If someone made some mistakes and they learned from them,
then that's a sign of a very good quality in a person.

IMO, people who don't understand that, are not worth pleasing or working
for.

If you think some people are being rude in their comments,
then keep in mind that it is you asking for help, and they tell you that
you do this the wrong way - being told about the rules of usenet is a
form of help you should appreciate. If you want to get help on your
problems for free, you have to respect those people reading and
commenting your posts.


I think his basic problem was, that he didn't expect help. In his mind, his
scripts didn't have problems, rather PHP had a strange behavior.
If only he had put a little effort into trying to understand what we were
trying to say. I thought your first suggestion was a clear and polite hint
that he should track down the problem in his code.

Anyway, it's not like one can demand what one wants, only hope to get what
one needs.
/Bent
[snip]
Jun 13 '06 #21
Bent Stigsen schrieb:
http://groups.google.ch/groups/profi...DuwKz324rebT9g
shows that you are quite new to newsgroups; you might want to read some
pages on netiquette. (I remember to have made some postings I am not
proud of when I first started to post to newsgroups, so I know what I
write about.)

When going head first into a mass of people from widely different cultures,
many trying to convey their message in a foreign language, then I think
some initial conflicts is what can be expected, regardless of the person.

And people change. If someone made some mistakes and they learned from them,
then that's a sign of a very good quality in a person.

IMO, people who don't understand that, are not worth pleasing or working
for.


Yes... I was actually argueing with people trying to tell me not to
top-post and to use a correct sig delimiter... :-) There are actually 2
communication problems about this stuff in usenet:
1. People who tell newbies they are assholes instead of just pointing
them the right direction
2. Newbies who assume they are told to be assholes even if they are
politely pointed to the right direction...

--
Markus
Jun 13 '06 #22
Markus Ernst wrote:
[snip]
Yes... I was actually argueing with people trying to tell me not to
top-post and to use a correct sig delimiter... :-) There are actually 2
communication problems about this stuff in usenet:
1. People who tell newbies they are assholes instead of just pointing
them the right direction
2. Newbies who assume they are told to be assholes even if they are
politely pointed to the right direction...


It's one of those things I can't figure out. Even without the aspects of
vanity, selfishness or rudeness, it is allways tempting to consider ones
own views and ideals as ultimately correct, which I straight off would
think made it very doubtful, that a person would change his ways merely
presented with a polite suggestion. (both ways)

It would have been easy, if the "rules" had been all facts and numbers, but
they aren't. People come in from a world of liberal thinking, individualism
and cut-throat competition. Much different than the ideas of uniformity and
altruism on the net. It is two worlds with widely different definitions of
"common sense" and efficiency.

If people don't readily believe it (whatever "we" make up), then without the
means of persuasion by appeal to facts or common sense, what else is there
than to just generally make it unpleasant to disagree, and in return expect
any reasonable person to object to that.

Then again, who would deny sinners a fair chance to repent. :)

--
/Bent
Jun 15 '06 #23
<snip>

I had the same problem. Page 1 uses an image map (the layout of booths
at a festival). Depending on where you click it calls page 2, sending it
the booth number you selected popping up a new window with the booth
number preselected. (ooooooooo)

<.in.Javascript ...>(page booth1.php)
url = "booth2.php ?" + "booth=" + booth;
win4 = window.open (url ,"", option);

:-O Notice :-O Notice ... Notice
(oh shutup)
So I added the ?missing? items.
url = "booth2.php ?" + "booth=" + booth +
"&name=&address =&phone=&email= &comment=";
win4 = window.open (url ,"", option);

The silence is deafening :-D

As an aside - Why da flip did someone decide that the "Notice" needed to
be spit out is beyond me. And shouldn't (is) there be a way to say
"Shhhhhhhh" IE "<?php -quite"
Jun 15 '06 #24
Cal Lidderdale schrieb:
As an aside - Why da flip did someone decide that the "Notice" needed to
be spit out is beyond me.
This is actually a service for you. Imagine writing an application with
some 1000s of lines of code, and at the end you just get a blank page -
I bet you would be quick in blaming PHP for letting you stand in the rain.
And shouldn't (is) there be a way to say "Shhhhhhhh" IE "<?php -quite"


If parameters are are optional it is quite easy to code:
$thing = isset($_POST['anything']) ? $_POST['anything'] : false;

If you prefer it the dirty way you can disable any level of error
reporting: www.php.net/error_reporting.

Good luck
Markus
Jun 15 '06 #25
Markus Ernst wrote:
Cal Lidderdale schrieb:
As an aside - Why da flip did someone decide that the "Notice" needed
to be spit out is beyond me.

This is actually a service for you. Imagine writing an application with
some 1000s of lines of code, and at the end you just get a blank page -
I bet you would be quick in blaming PHP for letting you stand in the rain.
And shouldn't (is) there be a way to say "Shhhhhhhh" IE "<?php -quite"

If parameters are are optional it is quite easy to code:


$list = array (name, address, phone);
foreach ($list as $item) {
$$item = isset($_GET["$item"]) ? $_GET["$item"] : false;
}

If you prefer it the dirty way you can disable any level of error
reporting: www.php.net/error_reporting.

Good luck
Markus


Thanks, old dog learn new trick :-D see above

( I tried to find a animated gif of a sweeping bow - ya know, sometimes
the internet stinks - How to tie a sweeping bow - No a bow not a bow. ) :-/
Jun 15 '06 #26
Cal Lidderdale schrieb:

$list = array (name, address, phone);
foreach ($list as $item) {
$$item = isset($_GET["$item"]) ? $_GET["$item"] : false;
}
Should actually display 3 undefined constant notices... change the use
of quotes, quote strings but not variables:

$list = array ('name', 'address', 'phone');
foreach ($list as $item) {
$$item = isset($_GET[$item]) ? $_GET[$item] : false;
}
( I tried to find a animated gif of a sweeping bow - ya know, sometimes
the internet stinks - How to tie a sweeping bow - No a bow not a bow. ) :-/


I am sorry I am not a native English speaker, and I don't understand
exactly what you mean. Anyway smell is a quite common phenomenon
wherever civilisation happens...
Jun 15 '06 #27

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

Similar topics

5
6550
by: Neil Strong | last post by:
I'm getting an error message "Unidentified Index" when reading posted variables from a form $x = $_POST I know I can use 'isset()' to check them first, but I'm curious as to why this works on some servers and not others......... Most of the servers I run it on just ignore the problem and result in the variable being assigned empty.
6
3877
by: Will | last post by:
I downloaded a webcounter from http://www.math.sunysb.edu/~shafikov/computing/webcounter. It seems to be working but I have the following being printed to the page: Notice: Undefined variable: counter in g:\program files\apache group\apache\htdocs\dev\webcounter.php on line 73 Notice: Undefined variable: prefix in g:\program files\apache group\apache\htdocs\dev\dbclass.php on line 33
1
1713
by: D. Alvarado | last post by:
Hello, Ia m running PHP 4 on Fedora Linus Apache 1.27. Since I have a dev box, I would like warnings to appear in the event of undefined variables or constants. But although I specified this setting in the php.ini file, ;error_reporting = E_COMPILE_ERROR|E_ERROR|E_CORE_ERROR ; ; - Show all errors except for notices ; error_reporting = E_ALL
7
2818
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: Undefined variable PHP Notice: Undefined index PHP Notice: Undefined property I'd like to go back and fix what I can, but I'm wondering: how good or bad is this? I mean, I rely on the fact that the first use of a variable
3
59785
by: bissatch | last post by:
Hi, I get the following error: Notice: Undefined variable: end_while in C:\Program Files\Apache\Apache2\htdocs\csp\inc\xmlmenu.php on line 102 This is a script that works on the server at work but it has difficulty
9
9610
by: petermichaux | last post by:
Hi, I am curious about how php deals with the following situation where I use an undefined index into an array. PHP seems to be behaving exactly how I want it to but I want to make sure that it is not a fluke. It seems like most programming languages would crash if you used an undefined index. Why does PHP work the way it does? My example is below
5
3469
by: DavidB | last post by:
Greetings I don't know if this is possible, but this group should be able to tell me. I have a webpage with a changing message board (I understand the problems with having changing text, but this was a nice victory over the demand for a scrolling message). The messages are updates on community information. What I would like to be able to do is have the background color (and possibly font color) change based on the Array Index. For...
9
5276
by: java | last post by:
Hey there, I just removed an elderly PHP4-Installation from my Windows-Box and installed PHP 5.2.1. I used the PHP4-Module as local batchfile- interpreter by E:\ersDHCP>php ./extractLog.php which was perfectly alright and worked well. But now PHP5 fails to run the same script without any modification!
6
20861
by: jsgoodrich | last post by:
I am looking for some help if anyone can lend a hand. I have a simple php website that displays a table from my mysql database. To prep for my MCSE I moved my home server to Windows 2003 Standard, I installed mysql and php 5 to run some of my databases and websites. Under Linux the site worked fine, under windows I keep getting Notice Undefined Index error on line 67
0
9845
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11279
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10981
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10499
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9675
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8047
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5893
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4725
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3323
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.