You are here: Re: Undefined Index notices « PHP Programming Language « IT news, forums, messages
Re: Undefined Index notices

Posted by Markus Ernst on 06/12/06 10:56

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. 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/profile?enc_user=AcliMxsAAADYssPP5XuA7Fx9WO2vLWuFafi1F26NDuwKz324rebT9g
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.) 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.

[snipped a lot of code]

> I have left *nothing* out, so now, if you or anyone else can please tell
> me why the notice is thrown.

I write this during my time that I am not paid for by anyone. Nobody in
this group has the duty to care for your problem. So instead of posting
either no code at all or the "entire mess", it might be a more
successful approach to track down the problem to it's essential parts.
Write a script only with the essential functionality, i.e.

<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST')
$id_option = $_POST['D1'];
else if ($_SERVER['REQUEST_METHOD'] == 'GET')
$id_option = $_GET['D1'];
print_r($_POST);
?>
<html>
<head></head>
<body>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<input type="hidden" name="D1" value="<?php echo $id_option; ?>">
<input type="submit" value="View Chart">
</form>
</body>
</html>

Now if the output of print_r shows that $_POST['D1'] is set, but line 3
still throws a notice, then your question is correct. In this example
you find that the notice is thrown at line 12 in the case that the form
has not been posted yet.
Maybe this shows your problem, otherwise add more parts of your code
until the problem occurs. You can also remove parts of your
functionality until the error disappears, or var_dump() the variables
step by step.
At the end, you either find your mistake yourself, or then you know the
appropriate question to ask, and have the appropriate code to post.

Yes this is a lot of work, but it makes a base for friendly people to
help you. Alternatively you can hire some PHP crack to solve your
problems, but you won't get them solved for free if you keep shouting at
the people you expect help from!

--
Markus

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация