Re: [PHP] Undefined index....

2013-03-15 Thread Serge Fonville
Hi,

Two questions:
Where is $xml defined and where is $pos defined?

HTH

Kind regards/met vriendelijke groet,

Serge Fonville

http://www.sergefonville.nl

Convince Microsoft!
They need to add TRUNCATE PARTITION in SQL Server
https://connect.microsoft.com/SQLServer/feedback/details/417926/truncate-partition-of-partitioned-table


2013/3/15 Jay Blanchard jay.blanch...@sigmaphinothing.org

 I have inherited a mess of a home-grown PHP framework that literally fills
 the error_log with 100's of thousands of messages each day. First order of
 business was rotating the logs, now we are working through each error to
 solve them. This is a fairly basic error, but I for the life of me cannot
 remember what the solution is.

 I have a recursive function that reads from XML files and replaces xi:
 include directives. It looks like this -

 function includeXML($file, $locale, $url, $level = 1) {
 // stuff
 while(($line = fgets($fp)) !== false) {
 if($pos === false) {
 $xml .= $line;
 } else {
 includeXML('repository/' . $included, $locale, (int)$level +
 $pos - 1);
 }
 }
 }

 Why do I get the notice that $xml is an undefined index? I do not want to
 suppress the notice, I just want to take care of it properly. I attempted
 setting $xml within the function but then the whole function fails for some
 reason in the depths of this hideous framework. Can anyone provide any
 insight? TVMIA!

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Undefined index....

2013-03-15 Thread Jay Blanchard

[snip]

Two questions:
Where is $xml defined and where is $pos defined?


[/snip]

$xml is defined in other functions, just not in this function. $pos is 
irrelevant to the question - it is just the string position within the 
file.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Undefined index....

2013-03-15 Thread Serge Fonville
So basically, $xml is out of scope for this function and you are appending
to a nonexisting variable?

Kind regards/met vriendelijke groet,

Serge Fonville

http://www.sergefonville.nl

Convince Microsoft!
They need to add TRUNCATE PARTITION in SQL Server
https://connect.microsoft.com/SQLServer/feedback/details/417926/truncate-partition-of-partitioned-table


2013/3/15 Jay Blanchard jay.blanch...@sigmaphinothing.org

 [snip]

  Two questions:
 Where is $xml defined and where is $pos defined?

  [/snip]

 $xml is defined in other functions, just not in this function. $pos is
 irrelevant to the question - it is just the string position within the file.


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Undefined index....

2013-03-15 Thread Lester Caine

Jay Blanchard wrote:

I have inherited a mess of a home-grown PHP framework that literally fills the
error_log with 100's of thousands of messages each day. First order of business
was rotating the logs, now we are working through each error to solve them. This
is a fairly basic error, but I for the life of me cannot remember what the
solution is.

I have a recursive function that reads from XML files and replaces xi: include
directives. It looks like this -

function includeXML($file, $locale, $url, $level = 1) {
 // stuff


$xml = '';
Should work here ...
Since the call below is ADDING to $xml you do need something existing to add to 
so what does that give?



 while(($line = fgets($fp)) !== false) {
 if($pos === false) {
 $xml .= $line;
 } else {
 includeXML('repository/' . $included, $locale, (int)$level + $pos -
1);
 }
 }
}

Why do I get the notice that $xml is an undefined index? I do not want to
suppress the notice, I just want to take care of it properly. I attempted
setting $xml within the function but then the whole function fails for some
reason in the depths of this hideous framework. Can anyone provide any insight?
TVMIA!


--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Undefined index....

2013-03-15 Thread Jay Blanchard

[snip]

function includeXML($file, $locale, $url, $level = 1) {
 // stuff


$xml = '';
Should work here ...
Since the call below is ADDING to $xml you do need something existing 
to add to so what does that give?

[/snip]

Thanks Lester, that worked. I had just put that in the wrong place. 
*slaps forehead*


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Undefined Index ...confusion

2009-07-23 Thread Kyle Smith

Miller, Terion wrote:

I keep getting this error while trying to use the field 'ID' to pass in a url.. 
And it's odd because the query is pulling everything BUT the ID which is the 
first field...

code:
a href=view.php?ID=?php echo $_SESSION['fullRestaurantList']['ID']??php 
echo htmlspecialchars(stripslashes($_SESSION['fullRestaurantList'][$i]['name'])); ?

  
We're going to need to know how the $_SESSION['fullRestaurantList'] gets 
populated.  Also, where do you define $i?  Is $i the ID?  Seemed like 
you've built an array of arrays and you may want 
$_SESSION['fullRestaurantList'][$i]['ID'], or just $i.  This is all 
speculation from the 2 lines of code I've seen though.


- Kyle



Re: [PHP] Undefined Index ...confusion

2009-07-23 Thread Miller, Terion



On 7/23/09 9:24 AM, Kyle Smith kyle.sm...@inforonics.com wrote:

Miller, Terion wrote:

I keep getting this error while trying to use the field 'ID' to pass in a url.. 
And it's odd because the query is pulling everything BUT the ID which is the 
first field...

code:
a href=view.php?ID=?php echo $_SESSION['fullRestaurantList']['ID']??php 
echo 
htmlspecialchars(stripslashes($_SESSION['fullRestaurantList'][$i]['name'])); ?


We're going to need to know how the $_SESSION['fullRestaurantList'] gets 
populated.  Also, where do you define $i?  Is $i the ID?  Seemed like you've 
built an array of arrays and you may want 
$_SESSION['fullRestaurantList'][$i]['ID'], or just $i.  This is all speculation 
from the 2 lines of code I've seen though.

- Kyle



The full script is (I have my Entourage email settings on html so I hope this 
displays ok for you all---seems I've been told it turns into a mess in some 
views) :

?php   




  // Check 
if page is set to show all
if(isset($_GET['show'])  $_GET['show'] == 'all')  
  {  unset($_SESSION['results']);   
   unset($_SESSION['searchname']);  
unset($_SESSION['address']);
   
}// 
Check if there was an empty search sent
if(isset($_SESSION['noVarsSent'])){ 
 echo pbNo values were submitted for the 
search./b/p;  // Unset it so a reload 
of page doesn't redisplay the error  
unset($_SESSION['noVarsSent']);  // 
unset($_SESSION['results']);}   

 // Check if full list of restaurants has been created and stored 
yet// Store full results in $_SESSION to 
limit database hits
if(!isset($_SESSION['fullRestaurantList']))
{  // List not grabbed yet, so run query 
and store in $_SESSION  
//check for rangeif 
(!(isset($rangenum)))  {
  $rangenum = 1;  } 
 // Grab all restaurants in alphabetical order  
$sql = SELECT restaurants.ID, name, address, 
inDate, inType, notes, critical, cviolations, noncritical FROM restaurants, 
inspections WHERE restaurants.name != '' AND restaurants.ID = inspections.ID 
ORDER BY name;;   $result = 
mysql_query($sql) or die(mysql_error());
//trying to grab it by ranges from the db?  
   $rows = mysql_num_rows($result); 
 $page_rows = 100;  
$last_row = ceil($rows/$page_rows); 
   if ($rangenum  1)   
 {  $rangenum = 1;  
}  elseif ($rangenum  
$last_row)  {   
   $rangenum = $last_row;  }
//This sets the 
range to display in our query  $max = 
'limit ' .($rangenum - 1) * $page_rows .',' .$page_rows;

// Process all results into 
$_SESSION array 
   $position = 1;   

Re: [PHP] Undefined Index ...confusion

2009-07-23 Thread Kyle Smith



Miller, Terion wrote:


On 7/23/09 9:24 AM, Kyle Smith kyle.sm...@inforonics.com wrote:

Miller, Terion wrote:

I keep getting this error while trying to use the field 'ID' to pass in a url.. 
And it's odd because the query is pulling everything BUT the ID which is the 
first field...

code:
a href=view.php?ID=?php echo $_SESSION['fullRestaurantList']['ID']??php 
echo htmlspecialchars(stripslashes($_SESSION['fullRestaurantList'][$i]['name'])); ?


We're going to need to know how the $_SESSION['fullRestaurantList'] gets 
populated.  Also, where do you define $i?  Is $i the ID?  Seemed like you've 
built an array of arrays and you may want 
$_SESSION['fullRestaurantList'][$i]['ID'], or just $i.  This is all speculation 
from the 2 lines of code I've seen though.

- Kyle



The full script is (I have my Entourage email settings on html so I hope this 
displays ok for you all---seems I've been told it turns into a mess in some 
views) :

  
It sure did turn into a big mess.  Could you try using a pastebin 
service?  You should do this as a general best-practice anyway.  Long 
email threads tend to turn people off to helping you.


Go here:
http://pastebin.ca/

Paste your code and select PHP for Syntax Highlighting, then click 
submit.  You'll be given a short URL to share with the thread that will 
bring us to an easy-to-read version of your code.


- Kyle


[Fwd: Re: [PHP] Undefined Index ...confusion]

2009-07-23 Thread Kyle Smith
Sorry, list, I did a reply instead of a reply-to-all.  This is what I 
sent to Miller, Terion


Miller, Terion wrote:

Thanks for the link Kyle!! Great thing there...(seriously I didn't know...I 
learn something everyday)

Anyways the link to my script is:  http://pastebin.ca/1504393
  

Your email client is annoying, it doesn't quote.  Haha.

Anyway, so, you're loading up that array with arrays of arrays, here:

  1.
 $position = 1;
  2.
  
  3.

 while ($row = mysql_fetch_array
 http://www.php.net/mysql_fetch_array($result))
  4.
   {
  5.
   $_SESSION['fullRestaurantList'][$position] = $row;
  6.
   $position++;
  7.
   }
  8.
   
  9.

   $_SESSION['totalNumberOfRestaurants'] = $position;

So, if you get 7 rows.  Your array will have:

Array = (Row 1 Data)
Array = (Row 2 Data)

.. etc

You do not have ['fullRestaurantList']['ID'].  In the page you're 
referencing you use something like 
$_SESSION['fullRestaurantList'][$i]['SomeValue'].  I assume $i is the 
Position in the array, so you likely want to use 
$_SESSION['fullRestaurantList'][$i]['ID'] to get the ID field from that row.


If you need a quick dump to better understand what data you have in your 
session, try making a page called session_dump.php in the same directory 
with this source:


pre? print_r($_SESSION) ?/pre

That will give you a good idea of what your session array looks like, 
and you should see clearly that ['fullRestaurantList']['ID'] does not exist.


Hope this helps!

- Kyle


Re: [Fwd: Re: [PHP] Undefined Index ...confusion] (RESOLVED)

2009-07-23 Thread Miller, Terion
Thanks


On 7/23/09 9:52 AM, Kyle Smith kyle.sm...@inforonics.com wrote:

Sorry, list, I did a reply instead of a reply-to-all.  This is what I
sent to Miller, Terion

Miller, Terion wrote:
 Thanks for the link Kyle!! Great thing there...(seriously I didn't know...I 
 learn something everyday)

 Anyways the link to my script is:  http://pastebin.ca/1504393

Your email client is annoying, it doesn't quote.  Haha.

Anyway, so, you're loading up that array with arrays of arrays, here:

   1.
  $position = 1;
   2.

   3.
  while ($row = mysql_fetch_array
  
http://www.php.net/mysql_fetch_arrayhttp://www.php.net/mysql_fetch_array($result))
   4.
{
   5.
$_SESSION['fullRestaurantList'][$position] = $row;
   6.
$position++;
   7.
}
   8.

   9.
$_SESSION['totalNumberOfRestaurants'] = $position;

So, if you get 7 rows.  Your array will have:

Array = (Row 1 Data)
Array = (Row 2 Data)

.. etc

You do not have ['fullRestaurantList']['ID'].  In the page you're
referencing you use something like
$_SESSION['fullRestaurantList'][$i]['SomeValue'].  I assume $i is the
Position in the array, so you likely want to use
$_SESSION['fullRestaurantList'][$i]['ID'] to get the ID field from that row.

If you need a quick dump to better understand what data you have in your
session, try making a page called session_dump.php in the same directory
with this source:

pre? print_r($_SESSION) ?/pre

That will give you a good idea of what your session array looks like,
and you should see clearly that ['fullRestaurantList']['ID'] does not exist.

Hope this helps!

- Kyle



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Undefined index error

2009-01-19 Thread Richard Heyes
 Notice: Undefined index: 2 in /home/raosetc/public_html/purl/p.php on line
 19

 and here is Line 19:

 $data = explode(/, $_SERVER['REQUEST_URI']);

Hi,

Are you sure it's an array? Use print_r() or var_dump() on
$_SERVER['REQUEST_URI'] on the preceding line. Just for testing, you
could do this too:

$_SERVER['REQUEST_URI'] = 'It/Works';

...on the preceding line.

-- 
Richard Heyes

HTML5 Graphing for Firefox, Chrome, Opera and Safari:
http://www.rgraph.org (Updated January 17th)

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Undefined index error

2009-01-19 Thread Jason Pruim


On Jan 19, 2009, at 2:32 PM, Richard Heyes wrote:

Notice: Undefined index: 2 in /home/raosetc/public_html/purl/p.php  
on line

19

and here is Line 19:

$data = explode(/, $_SERVER['REQUEST_URI']);


Hi,

Are you sure it's an array? Use print_r() or var_dump() on
$_SERVER['REQUEST_URI'] on the preceding line. Just for testing, you
could do this too:

$_SERVER['REQUEST_URI'] = 'It/Works';

...on the preceding line.


actually at that point it's not an array... it's just loading  
purl.mysupersite.com/test so REQUEST_URI just contains test I just  
want to squash that error until they go to a page in the site :)


I'm thinking I just need to think this one through a little bit and  
I'm sure the solution ill come to me.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Undefined index error

2009-01-19 Thread Daniel Brown
On Mon, Jan 19, 2009 at 14:32, Richard Heyes rich...@php.net wrote:
 Notice: Undefined index: 2 in /home/raosetc/public_html/purl/p.php on line
 19

 and here is Line 19:

 $data = explode(/, $_SERVER['REQUEST_URI']);

When I view that file, on line 19, I see:

echo HTML


 Are you sure it's an array? Use print_r() or var_dump() on
 $_SERVER['REQUEST_URI'] on the preceding line. Just for testing, you
 could do this too:

 $_SERVER['REQUEST_URI'] = 'It/Works';

 ...on the preceding line.

Well, that wouldn't address the issue of the code he gave on the
line reported, but I know what you mean, Richy.  He's turning
$_SERVER['REQUEST_URI'] into an array with explode() if it contains a
forward-slash (/).

What would be better in that case would be:

?php
$data = isset($_SERVER['REQUEST_URI']) 
strlen($_SERVER['REQUEST_URI'])  0 ?
explode('/',$_SERVER['REQUEST_URI']) : $_SERVER['REQUEST_URI'];

if(is_array($data)) {
// Handle as appropriate.
}
?

However, that's not the best option as:

1.) REQUEST_URI may not (though it should) have *any* forward
slashes in the URI passed to PHP by the HTTP server.
2.) It leaves too much other stuff to be done.

Instead, check out:

?php
$data = basename($_SERVER['REQUEST_URI']);
echo $data; // In case you're not yet aware of what you'll receive
from the use of basename()
?

-- 
/Daniel P. Brown
daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
Unadvertised dedicated server deals, too low to print - email me to find out!

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Undefined index error

2009-01-19 Thread ceo

There is no reference to index '2' in that line 19.



What is the next line?



Something which expects at least 3 elements in the URI, perhaps?...

[Hint, hint]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Undefined index error

2009-01-19 Thread Jason Pruim


On Jan 19, 2009, at 3:28 PM, Daniel Brown wrote:


On Mon, Jan 19, 2009 at 14:32, Richard Heyes rich...@php.net wrote:
Notice: Undefined index: 2 in /home/raosetc/public_html/purl/p.php  
on line

19

and here is Line 19:

$data = explode(/, $_SERVER['REQUEST_URI']);


   When I view that file, on line 19, I see:

echo HTML


Only when you log into certain accounts and view the file after I had  
made changes :P





Are you sure it's an array? Use print_r() or var_dump() on
$_SERVER['REQUEST_URI'] on the preceding line. Just for testing, you
could do this too:

$_SERVER['REQUEST_URI'] = 'It/Works';

...on the preceding line.


   Well, that wouldn't address the issue of the code he gave on the
line reported, but I know what you mean, Richy.  He's turning
$_SERVER['REQUEST_URI'] into an array with explode() if it contains a
forward-slash (/).

   What would be better in that case would be:

?php
$data = isset($_SERVER['REQUEST_URI']) 
strlen($_SERVER['REQUEST_URI'])  0 ?
explode('/',$_SERVER['REQUEST_URI']) : $_SERVER['REQUEST_URI'];

if(is_array($data)) {
   // Handle as appropriate.
}
?

   However, that's not the best option as:

   1.) REQUEST_URI may not (though it should) have *any* forward
slashes in the URI passed to PHP by the HTTP server.
   2.) It leaves too much other stuff to be done.

   Instead, check out:

?php
$data = basename($_SERVER['REQUEST_URI']);
echo $data; // In case you're not yet aware of what you'll receive
from the use of basename()

?



I'm not positive that does exactly what I want... What I'm really  
going for is given this URL:


purl.mysupersite.com/test/mail

test refers to a record in the database.
mail refers to a file on the server which is included when mail is  
present. Otherwise the main page is used.




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Undefined index error

2009-01-19 Thread Daniel Brown
On Mon, Jan 19, 2009 at 15:39, Jason Pruim japr...@raoset.com wrote:

 Only when you log into certain accounts and view the file after I had made
 changes :P

I figured you had already changed it, but when you're root, you
don't have to log in to other accounts.  ;-P

 What I'm really going for is given this URL:

 purl.mysupersite.com/test/mail

 test refers to a record in the database.
 mail refers to a file on the server which is included when mail is
 present. Otherwise the main page is used.

So then you'll use mod_rewrite, since Apache needs to tell PHP how
to parse it.  Otherwise, Apache is going to be looking for /test/mail.

#.htaccess:
#
Options -MultiViews

RewriteEngine On

#
## Redirect to remove trailing slashes on extensionless URL requests
# If requested URL ending with slash does not resolve to an existing
directory
RewriteCond %{REQUEST_FILENAME} !-d

#  externally redirect to remove trailing slash.
RewriteRule ^(.+)/$ /index.php?s=$1 [QSA,L]


#
## Externally redirect clients directly requesting .php page URIs to
extensionless URIs
# If client request header contains php file extension
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /[^.]+\.php\ HTTP

# externally redirect to extensionless URI.
RewriteRule ^([^.]+)\.php$ /index.php?s=$1 [QSA,R=301,L]


#
## Internally rewrite extensionless file requests to .php files ##
# If the requested URI does not contain a period in the final path-part
RewriteCond %{REQUEST_URI} !(\.[^./]+)$

#  and if it does not exist as a directory
RewriteCond %{REQUEST_FILENAME} !-d

#  and if it does not exist as a file
RewriteCond %{REQUEST_FILENAME} !-f

#  then add .php to get the actual filename.
RewriteRule (.+) /index.php?s=$1 [QSA,L]

# End .htaccess


You can figure out the rest yourself.  ;-P

-- 
/Daniel P. Brown
daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
Unadvertised dedicated server deals, too low to print - email me to find out!

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Undefined index:

2007-06-16 Thread tedd

At 2:37 PM +0200 6/16/07, WeberSites LTD wrote:

I'm using this code to check if a cookie has a value :

If(!IsSet($HTTP_COOKIE_VARS[LoggedIn])) 


In case that this cookie is not set, how can i avoid the
Undefined index: line in the error log?

berber


berber:

Try this:

$loggedIn = isset($HTTP_COOKIE_VARS[LoggedIn]) ? 
($HTTP_COOKIE_VARS[LoggedIn]) : not logged in;

echo($loggedIn);

Cheers,

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Undefined index:

2007-06-16 Thread Stut

WeberSites LTD wrote:
I'm using this code to check if a cookie has a value : 
 
If(!IsSet($HTTP_COOKIE_VARS[LoggedIn])) 
 
 
In case that this cookie is not set, how can i avoid the 
Undefined index: line in the error log?


The isset function does not give an error if you pass it a non-existant 
variable. Are you sure it's this line that's causing the undefined index 
error?


-Stut

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Undefined index error

2007-06-10 Thread Tijnema

On 6/10/07, Christian Cantrell [EMAIL PROTECTED] wrote:

I'm getting this error in my Apache log file, and I can't figure out why:

Undefined index:  password in /path/to/file.php on line 82

Some searching on Google turned up a bunch of questions, but no answers.
Any idea what this warning message is referring to?

Thanks,
Christian


Yes, you're probably trying to get a value from an array by using a
key that isn't in the array.
Something like this:
?php
$array = array( user= test, foo=bar);
$value = $array['password']; // Key password doesn't exist!
?

Check the line number and print out the array with var_dump/print_r to
see what's in the array..

Tijnema




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Undefined index error

2007-06-10 Thread Christian Cantrell

Ah, you're right.  Thanks, Tijnema.

I'm just getting my feet wet with PHP, and you guys are a great help!

Christian

On 6/10/07, Tijnema [EMAIL PROTECTED] wrote:


On 6/10/07, Christian Cantrell [EMAIL PROTECTED] wrote:
 I'm getting this error in my Apache log file, and I can't figure out
why:

 Undefined index:  password in /path/to/file.php on line 82

 Some searching on Google turned up a bunch of questions, but no answers.
 Any idea what this warning message is referring to?

 Thanks,
 Christian

Yes, you're probably trying to get a value from an array by using a
key that isn't in the array.
Something like this:
?php
$array = array( user= test, foo=bar);
$value = $array['password']; // Key password doesn't exist!
?

Check the line number and print out the array with var_dump/print_r to
see what's in the array..

Tijnema




Re: [PHP] Undefined index error

2007-06-10 Thread Richard Lynch


On Sat, June 9, 2007 11:53 pm, Christian Cantrell wrote:
 I'm getting this error in my Apache log file, and I can't figure out
 why:

 Undefined index:  password in /path/to/file.php on line 82

 Some searching on Google turned up a bunch of questions, but no
 answers.
 Any idea what this warning message is referring to?

If you use something like:
$_POST['password']
$_COOKIE['password'] // this is a REALLY Bad Idea
$_GET['password'] //bad idea
$_SESSION['password']
.
.
.

but you don't actually *HAVE* a 'password' in the array, then you will
get that error message.

Your assumption that you have some kind of password is invalid.

Check first:

if (isset($whatever['password'])){
  //rest of your code in here.
}

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Undefined index error

2007-06-09 Thread Robert Cummings
On Sun, 2007-06-10 at 00:53 -0400, Christian Cantrell wrote:
 I'm getting this error in my Apache log file, and I can't figure out why:
 
 Undefined index:  password in /path/to/file.php on line 82

Please post the code on that line of the file indicated.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] undefined index and php

2005-11-10 Thread Jasper Bryant-Greene

Ross wrote:
because the following line give the notice 'undefined index'  BEFORE  the 
submit button has been pressed..


? $heading_insert= stripslashes($_POST['heading']);?


That's because before the submit button has been pressed, $_POST is 
empty and so 'heading' is indeed an undefined index. Try:


$heading_insert = isset( $_POST['heading'] ) ? stripslashes( 
$_POST['heading'] ) : '';


By the way, while you're switching register_globals off, it might be a 
good idea to also switch off magic_quotes_gpc (the reason you need 
stripslashes() above) and short_open_tag (judging by your use of the 
non-portable ? open tag rather than ?php).


Jasper

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] undefined index and php

2005-11-10 Thread ross

I have never really used this abreviated format before

why the question mark and the colon? What is the long hang eqivalent.

I turned magic quotes off too.

thanks.

R.
- Original Message - 
From: Jasper Bryant-Greene [EMAIL PROTECTED]

To: Ross [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Sent: Thursday, November 10, 2005 12:19 PM
Subject: Re: [PHP] undefined index and php



Ross wrote:
because the following line give the notice 'undefined index'  BEFORE  the 
submit button has been pressed..


? $heading_insert= stripslashes($_POST['heading']);?


That's because before the submit button has been pressed, $_POST is empty 
and so 'heading' is indeed an undefined index. Try:


$heading_insert = isset( $_POST['heading'] ) ? stripslashes( 
$_POST['heading'] ) : '';


By the way, while you're switching register_globals off, it might be a 
good idea to also switch off magic_quotes_gpc (the reason you need 
stripslashes() above) and short_open_tag (judging by your use of the 
non-portable ? open tag rather than ?php).


Jasper





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] undefined index and php

2005-11-10 Thread Robbert van Andel
The question mark and colon is the equivalent for the iif function.  It's a
short hand for if/else.  You start with the expression, and if true, do
what's after the question mark and if false, after the column.

Robbert

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Thursday, November 10, 2005 4:58 AM
To: php-general@lists.php.net
Subject: Re: [PHP] undefined index and php

I have never really used this abreviated format before

why the question mark and the colon? What is the long hang eqivalent.

I turned magic quotes off too.

thanks.

R.
- Original Message - 
From: Jasper Bryant-Greene [EMAIL PROTECTED]
To: Ross [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Sent: Thursday, November 10, 2005 12:19 PM
Subject: Re: [PHP] undefined index and php


 Ross wrote:
 because the following line give the notice 'undefined index'  BEFORE  the

 submit button has been pressed..

 ? $heading_insert= stripslashes($_POST['heading']);?

 That's because before the submit button has been pressed, $_POST is empty 
 and so 'heading' is indeed an undefined index. Try:

 $heading_insert = isset( $_POST['heading'] ) ? stripslashes( 
 $_POST['heading'] ) : '';

 By the way, while you're switching register_globals off, it might be a 
 good idea to also switch off magic_quotes_gpc (the reason you need 
 stripslashes() above) and short_open_tag (judging by your use of the 
 non-portable ? open tag rather than ?php).

 Jasper


 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] undefined index and php

2005-11-10 Thread Jochem Maas

Robbert van Andel wrote:

The question mark and colon is the equivalent for the iif function.  It's a


'if () ...' is not a function it's a language construct. they are different :-)
for instance 'echo' is also a language construct which is why it does not 
require
brackets e.g.

$space = ' ';
echo hello,$space,world;


short hand for if/else.  You start with the expression, and if true, do
what's after the question mark and if false, after the column.

Robbert

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Thursday, November 10, 2005 4:58 AM

To: php-general@lists.php.net
Subject: Re: [PHP] undefined index and php

I have never really used this abreviated format before

why the question mark and the colon? What is the long hang eqivalent.

I turned magic quotes off too.

thanks.

R.
- Original Message - 
From: Jasper Bryant-Greene [EMAIL PROTECTED]

To: Ross [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Sent: Thursday, November 10, 2005 12:19 PM
Subject: Re: [PHP] undefined index and php




Ross wrote:


because the following line give the notice 'undefined index'  BEFORE  the




submit button has been pressed..

? $heading_insert= stripslashes($_POST['heading']);?


That's because before the submit button has been pressed, $_POST is empty 
and so 'heading' is indeed an undefined index. Try:


$heading_insert = isset( $_POST['heading'] ) ? stripslashes( 
$_POST['heading'] ) : '';


By the way, while you're switching register_globals off, it might be a 
good idea to also switch off magic_quotes_gpc (the reason you need 
stripslashes() above) and short_open_tag (judging by your use of the 
non-portable ? open tag rather than ?php).


Jasper








--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] undefined index and php

2005-11-10 Thread Gustavo Narea

Hello.

[EMAIL PROTECTED] wrote:

why the question mark and the colon? What is the long hang eqivalent.


That's the Ternary operator. Whether you want to get further 
information, go to: 
http://php.net/manual/en/language.operators.comparison.php


Regards.

--
Gustavo Narea.
PHP Documentation - Spanish Translation Team.
Valencia, Venezuela.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] undefined index and php

2005-11-10 Thread Richard Lynch
On Thu, November 10, 2005 5:54 am, Ross wrote:
 Before someone advises me to 'google' my question. I have and can't
 find a
 PHP.net example either.

 I have turned off registered globals and am updating my scripts so
 they work
 but I keep getting an undefined index problem using $_POST

 I tried this to set the value...

 if (!isset($_POST['heading'])) {
 $_POST ['heading'] = ;
 }

 because the following line give the notice 'undefined index'  BEFORE
 the
 submit button has been pressed..

 ? $heading_insert= stripslashes($_POST['heading']);?

This bit of code is getting run BEFORE the submit button has been
pressed.

In that case, $_POST itself is not defined, much less $_POST['heading']

You really shouldn't be stuffing values into $_POST.  Think of it as a
read-only variable that the browser sends TO you.

Here are some options:

OPTION 1:
?php
  $heading_insert = '';
  if (isset($_POST['heading'])){
$heading_insert = stripslashes($_POST['heading']);
  }
?

OPTION 2:
?php
  $heading_insert = isset($_POST['heading']) ?
stripslashes($_POST['heading']) : '';
?

Some people think the ternary operator is confusing or obscure or
whatever.  Others think it's a perfectly natural operator.  YMMV

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] undefined index

2005-06-17 Thread Kim Madsen

 -Original Message-
 From: Ross [mailto:[EMAIL PROTECTED]
 Sent: Thursday, June 16, 2005 8:51 PM


 if ($quantity == 0){
 
 }
else {
 
  $pieces = explode( , $quantity);
$formatted_price = sprintf('%0.2f', $pricecode);
   echo table width=\240\ border=\0\ cellpadding=\2\
 cellspacing=\5\trtd valign=\top\ align=\right\
 width=\40\$pieces[0]/tdtd align=\left\ width=\60\/tdtd
 align=\left\ width=\200\$pieces[1] $pieces[2] $pieces[3]
 $pieces[4]/tdtd valign=\top\ align=\left\
 width=\80\$formatted_price/td/tr/table;
 
}
}
 
 The trouble is I get a NOTICE that tells me the indexes 1 to 4 have
not
 been defined. how do I do this.

Probably because $quantity IS 0, then the vars used in the else {} is
never set, but still in the script.

Try setting these before the if statement:

$pieces = array(); 
$formatted_price = 0;
$pricecode = 0; // this one is never set? Or set earlier in the script?


--
Med venlig hilsen / best regards
ComX Networks A/S
Kim Madsen
Systemudvikler/Systemdeveloper

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] undefined index

2005-06-16 Thread Philip Hallstrom

I have a bit of code that splices up a cookie into 4 bits so the information
can be displayedin a neat way in a table



if ($quantity == 0){

   }
  else {

$pieces = explode( , $quantity);
  $formatted_price = sprintf('%0.2f', $pricecode);
 echo table width=\240\ border=\0\ cellpadding=\2\
cellspacing=\5\trtd valign=\top\ align=\right\
width=\40\$pieces[0]/tdtd align=\left\ width=\60\/tdtd
align=\left\ width=\200\$pieces[1] $pieces[2] $pieces[3]
$pieces[4]/tdtd valign=\top\ align=\left\
width=\80\$formatted_price/td/tr/table;

  }
  }

The trouble is I get a NOTICE that tells me the indexes 1 to 4 have not been
defined. how do I do this.


What is the output of:

print_r($pieces) if placed right after the explode() line?  Maybe 
$quantity isn't what you think it is...


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] undefined index: $_FILES || $HTTP_POST_FILES

2004-11-08 Thread Marek Kilimajer
Tobias Neumann wrote:
Hello!
I have the same script on two webservers with php 4.3.9 and apache 2, both
with the same php configurations. On one server I can not access
$_FILES or $HTTP_POST_FILES, although a form with a file has been
correctly submitted.
apache_request_headers() contains:
[Content-Type] = multipart/form-data;
boundary=---207315575716727585901748724465
[Content-Length] = 5779
So php should have received the form data. I can access $_GET and $_POST
without any problem.
$_FILES and $HTTP_POST_FILES do simply not exist, and when I try
to access them I just get an undefined index error, or with print_r() an
empty array.
Regards,
  Tobias Neumann
http://sk2.php.net/manual/en/features.file-upload.php
Read the Related Configurations Note and also check enctype attribute of 
your form

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] undefined index: $_FILES || $HTTP_POST_FILES

2004-11-08 Thread raditha dissanayake
Tobias Neumann wrote:
Hello!
I have the same script on two webservers with php 4.3.9 and apache 2, both
with the same php configurations. On one server I can not access
$_FILES or $HTTP_POST_FILES, although a form with a file has been
correctly submitted.
 

Quick question: is file uploads enabled on this server and is the 
temporary directory writable?

apache_request_headers() contains:
[Content-Type] = multipart/form-data;
boundary=---207315575716727585901748724465
[Content-Length] = 5779
So php should have received the form data. I can access $_GET and $_POST
without any problem.
$_FILES and $HTTP_POST_FILES do simply not exist, and when I try
to access them I just get an undefined index error, or with print_r() an
empty array.
Regards,
 Tobias Neumann
 


--
Raditha Dissanayake.

http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 128 KB | with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] undefined index: $_FILES || $HTTP_POST_FILES

2004-11-08 Thread Jason Wong
On Monday 08 November 2004 09:07, Tobias Neumann wrote:

 I have the same script on two webservers with php 4.3.9 and apache 2, both
 with the same php configurations. On one server I can not access
 $_FILES or $HTTP_POST_FILES, although a form with a file has been
 correctly submitted.

Are the httpd.conf config the same as well?

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
I go on working for the same reason a hen goes on laying eggs.
- H. L. Mencken
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] undefined index: $_FILES || $HTTP_POST_FILES

2004-11-08 Thread Tobias Neumann
On Mon, 08 Nov 2004 15:52:53 +0600, Raditha Dissanayake wrote:

 Quick question: is file uploads enabled on this server and is the 
 temporary directory writable?

Hmm. upload_tmp_dir was unset. The php.ini says that in this case the
systems default tempoary directory is used. So I guessed it would be
/tmp, because php also saves the session data there. Now I set the
upload_tmp_dir explicit to /tmp and it works.

So where on linux systems is the default tempoary directory set?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Undefined index ???

2004-06-09 Thread John Nichel
Michael Jonsson wrote:
Hi
Why do I get an error if the $_SESSION['user_status'] is NULL ???
Script##
session_start();
echo $_SESSION['user_status'];
#error##
Notice: Undefined index: user_status in 
/var/www/itmdata/include/include.php on line 13


Regards
Micke

That's not an error.  Three ways to solve this...
1)  Turn down your error reporting level.
2)  Declare your variables before using them
$_SESSION['user_status'] = NULL;
echo ( $_SESSION['user_status'] );
3)  Code for variables that may not exist
if ( isset ( $_SESSION['user_status'] ) ) {
echo ( $_SESSION['user_status'] );
}
Or any combination of the three.
--
John C. Nichel
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Undefined index ???

2004-06-09 Thread Torsten Roehr
John Nichel [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Michael Jonsson wrote:
  Hi
 
  Why do I get an error if the $_SESSION['user_status'] is NULL ???
 
 
  Script##
  session_start();
  echo $_SESSION['user_status'];
 
 
  #error##
  Notice: Undefined index: user_status in
  /var/www/itmdata/include/include.php on line 13
 
 
 
  Regards
  Micke
 


 That's not an error.  Three ways to solve this...

 1)  Turn down your error reporting level.
 2)  Declare your variables before using them

 $_SESSION['user_status'] = NULL;
 echo ( $_SESSION['user_status'] );

 3)  Code for variables that may not exist

 if ( isset ( $_SESSION['user_status'] ) ) {
 echo ( $_SESSION['user_status'] );
 }

 Or any combination of the three.


I would not recommend turning down the error reporting level. This might
lead to unexpected behaviour in your application and makes it hard to back
track errors.

Always develop with error reporting set to E_ALL. You may set a lower level
for your production environment and disable the display of errors:
ini_set('display_errors', 0);

Regards, Torsten Roehr

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] undefined index -------- please help !!!!!!!!

2004-03-08 Thread Dominique ANOKRE
OK, but when i use isset my request is not executed normally.
I wonder if the fact i use the frames is the problem because with no
changement and without using isset
my request run correctly.

Thanks !

- Original Message -
From: John Nichel [EMAIL PROTECTED]
To: Dominique ANOKRE [EMAIL PROTECTED]
Cc: Php List [EMAIL PROTECTED]
Sent: Saturday, March 06, 2004 12:15 PM
Subject: Re: [PHP] undefined index  please help 


 Dominique ANOKRE wrote:
  on line 66 there is :
 
  $date=$_POST[date];
 
  Thanks

 $_POST['date'] isn't set.

 if ( isset ( $_POST['date'] ) ) {
 $date = $_POST['date'];
 }

 --
 By-Tor.com
 It's all about the Rush
 http://www.by-tor.com

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] undefined index -------- please help !!!!!!!!

2004-03-06 Thread Dominique ANOKRE
on line 66 there is :

$date=$_POST[date];

Thanks

- Original Message -
From: Chris W. Parker [EMAIL PROTECTED]
To: Dominique ANOKRE [EMAIL PROTECTED]; Php List
[EMAIL PROTECTED]
Sent: Friday, March 05, 2004 8:20 PM
Subject: RE: [PHP] undefined index  please help 


Dominique ANOKRE mailto:[EMAIL PROTECTED]
on Friday, March 05, 2004 12:19 PM said:

 Undefined index: numcpte in c:\inetpub\wwwroot\rech_haut.php on line
 66

 For information, i have not this error when the file recherche.php is
 a simple file without frames !!!

 Please help!!

what is on line 66!?!?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] undefined index -------- please help !!!!!!!!

2004-03-06 Thread John Nichel
Dominique ANOKRE wrote:
on line 66 there is :

$date=$_POST[date];

Thanks
$_POST['date'] isn't set.

if ( isset ( $_POST['date'] ) ) {
$date = $_POST['date'];
}
--
By-Tor.com
It's all about the Rush
http://www.by-tor.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] undefined index -------- please help !!!!!!!!

2004-03-05 Thread Chris W. Parker
Dominique ANOKRE mailto:[EMAIL PROTECTED]
on Friday, March 05, 2004 12:19 PM said:

 Undefined index: numcpte in c:\inetpub\wwwroot\rech_haut.php on line
 66 
 
 For information, i have not this error when the file recherche.php is
 a simple file without frames !!! 
 
 Please help!!

what is on line 66!?!?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Undefined Index Errors

2004-02-06 Thread Marek Kilimajer
You can either:

1. put @ in front of each variable, e.g.
$adminID = @$_ENV['HTTP_REMOTE_USER'];
2. change your error reporting level:
error_reporting(E_ALL ^ E_NOTICE);
Cameron B. Prince wrote:

Hey guys,

Here's a chunk of code from the top of a multi-function page I converted
from Perl to PHP:
$userid   = $_REQUEST['USERID'];# USERID = selected userid
$dlist= $_REQUEST['DLIST']; # DLIST = indicates who to display
$action   = $_REQUEST['ACTION'];# ACTION = indicates approval or
denial
$more = $_REQUEST['MORE'];  # MORE = ID of person to show
details
$delete   = $_REQUEST['DELETE'];# DELETE = indicates to delete user
$ltr  = $_REQUEST['LTR'];   # LTR = start ltr of last name
$modpwd   = $_REQUEST['MODPWD'];# MODPWD = indicates modifying pwd
$expire   = $_REQUEST['EXPIRE'];# EXPIRE = indicates to expire pwd
$upduser  = $_REQUEST['UPDUSER'];   # UPDUSER = indicates user info
updated
$denyuser = $_REQUEST['DENYUSER'];  # DENYUSER = indicates user was
denied
$reason   = $_REQUEST['REASON'];# REASON = Reason user was denied
$adminID = $_ENV['HTTP_REMOTE_USER'];

I'm creating some strings from array elements obviously. The issue is, the
array elements don't always exist depending on which function you are
running. And when they don't, the server log is full of undefined index
errors. Is there a way I can avoid these errors without adding a
if(isset(...)) around each one?
Thanks,
Cameron
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Undefined Index Errors

2004-02-06 Thread Adam Bregenzer
On Fri, 2004-02-06 at 10:51, Cameron B. Prince wrote:
 I'm creating some strings from array elements obviously. The issue is, the
 array elements don't always exist depending on which function you are
 running. And when they don't, the server log is full of undefined index
 errors. Is there a way I can avoid these errors without adding a
 if(isset(...)) around each one?

If you know which variables are required per 'function' that is being
called wrap an if around these variable declarations in blocks.  You
will still have ifs, but you should have a lot fewer.  If by function
you mean actual functions then you could move these lines to the top of
their respective functions.

-- 
Adam Bregenzer
[EMAIL PROTECTED]
http://adam.bregenzer.net/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Undefined Index Errors

2004-02-06 Thread John W. Holmes
From: Cameron B. Prince [EMAIL PROTECTED]

 I'm creating some strings from array elements obviously. The issue is, the
 array elements don't always exist depending on which function you are
 running. And when they don't, the server log is full of undefined index
 errors. Is there a way I can avoid these errors without adding a
 if(isset(...)) around each one?

Adjust your error_reporting() level so these notices don't show up.

---John Holmes...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Undefined Index Errors

2004-02-06 Thread Cameron B. Prince
 1. put @ in front of each variable, e.g.
   $adminID = @$_ENV['HTTP_REMOTE_USER'];

This worked very nicely...

Thank you!



  Hey guys,
 
  Here's a chunk of code from the top of a multi-function page I converted
  from Perl to PHP:
 
  $userid   = $_REQUEST['USERID'];# USERID = selected userid
  $dlist= $_REQUEST['DLIST']; # DLIST = indicates who
 to display
  $action   = $_REQUEST['ACTION'];# ACTION = indicates approval or
  denial
  $more = $_REQUEST['MORE'];  # MORE = ID of person to show
  details
  $delete   = $_REQUEST['DELETE'];# DELETE = indicates to
 delete user
  $ltr  = $_REQUEST['LTR'];   # LTR = start ltr of last name
  $modpwd   = $_REQUEST['MODPWD'];# MODPWD = indicates
 modifying pwd
  $expire   = $_REQUEST['EXPIRE'];# EXPIRE = indicates to
 expire pwd
  $upduser  = $_REQUEST['UPDUSER'];   # UPDUSER = indicates user info
  updated
  $denyuser = $_REQUEST['DENYUSER'];  # DENYUSER = indicates user was
  denied
  $reason   = $_REQUEST['REASON'];# REASON = Reason user
 was denied
 
  $adminID = $_ENV['HTTP_REMOTE_USER'];
 
  I'm creating some strings from array elements obviously. The
 issue is, the
  array elements don't always exist depending on which function you are
  running. And when they don't, the server log is full of undefined index
  errors. Is there a way I can avoid these errors without adding a
  if(isset(...)) around each one?
 
  Thanks,
  Cameron
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Undefined index???

2003-12-12 Thread Jason Wong
On Friday 12 December 2003 15:43, [EMAIL PROTECTED] wrote:

 I keep getting this error:

 Notice: Undefined index: tutor_id in /usr/local/..

 What does undefined index exactly mean?? I did a search on the web but
 couldn't find any solutions.

Basically it means you're trying to access a non-existent item in the array.

 The line that cause this error is as follow:

 $tutor_id = $_POST[tutor_id];

  print_r($_POST)

will show all the items in $_POST. Is your form set to use the post method? 
If not then look in $_GET for your form input data.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
No snowflake in an avalanche ever feels responsible.
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Undefined index???

2003-12-12 Thread irinchiang


On Friday 12 December 2003 15:43, [EMAIL PROTECTED] wrote: 

 I keep getting this error: 
 
 Notice: Undefined index: tutor_id in /usr/local/.. 
 
 What does undefined index exactly mean?? I did a search on the web but 
 couldn't find any solutions. 

Basically it means you're trying to access a non-existent item in the array. 

 The line that cause this error is as follow: 
 
 $tutor_id = $_POST[tutor_id]; 

  print_r($_POST) 

will show all the items in $_POST. Is your form set to use the post method? 
If not then look in $_GET for your form input data. 

---
yah my form has been set to use the POST method:

echo form name=\edit_tutor\ method=\post\ action=\edit2.php\;

What could be the problem???Or it could be related to quoting problem:

$sql = mysql_query (SELECT * FROM tutor WHERE tutor_id='$tutor_id');
or
$sql = mysql_query (SELECT * FROM tutor WHERE tutor_id=$tutor_id);



What is the right way to define the variable $tutor_id 

--
For reference, I have copied the block of code below:

$dsn = mysql://root:[EMAIL PROTECTED]/tablename;

//connect to DB
$db = DB::connect ($dsn);
//check for any DB connection errors
   if (DB::isError ($db))
   die ($db-getMessage());

$action = $_GET[action];

$tutor_id = $_POST['tutor_id'];

print_r($_POST);

if($action == delete)
{
$sql = mysql_query (DELETE FROM tutor WHERE tutor_id='$tutor_id');

$result = $db-query($sql);

if( DB::isError($result) ) {
die ($result-getMessage());
}

echo a href='../index/timetable_main.php'Back to main/a;
}

if($action == edit)
{
$sql = mysql_query (SELECT * FROM tutor WHERE tutor_id='$tutor_id');

$row = mysql_fetch_array($sql);

echo form name=\edit_tutor\ method=\post\ action=\edit2.php\;
echo Tutor ID : .$row['tutor_id'].br;
echo input type=\hidden\ name=\tutor_id\ value=\.$row
['tutor_id'].\;
echo Name : input name=\tutor_name\ type=\text\ value=\.$row
['tutor_name'].\br;
echo Contact No : input type=\text\ name=\tutor_contact\ value=\.$row
['tutor_contact'].\br;
echo E-mail : input type=\text\ name=\tutor_email\ value=\.$row
['tutor_email'].\br;
echo Profile : input type=\text\ name=\tutor_profile\ value=\.$row
['tutor_profile'].\br;
echo input type=\submit\ name=\Submit\ value=\Update\;
echo /form;

}
?

echo The entry has been deleted brbr;


For reference, i have copied the block of code below:


Irin.
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Undefined index???

2003-12-12 Thread Marek Kilimajer
[EMAIL PROTECTED] wrote:
On Friday 12 December 2003 15:43, [EMAIL PROTECTED] wrote: 


I keep getting this error: 

Notice: Undefined index: tutor_id in /usr/local/.. 

What does undefined index exactly mean?? I did a search on the web but 
couldn't find any solutions. 


Basically it means you're trying to access a non-existent item in the array. 


The line that cause this error is as follow: 

$tutor_id = $_POST[tutor_id]; 


  print_r($_POST) 

will show all the items in $_POST. Is your form set to use the post method? 
If not then look in $_GET for your form input data. 

---
yah my form has been set to use the POST method:
Are you sure? You print out this form in this script, but that is not 
how you got here.

echo form name=\edit_tutor\ method=\post\ action=\edit2.php\;

What could be the problem???Or it could be related to quoting problem:

Not at all, remember the notice is displayed before you run this query. 
But always make sure user input is ALWAYS quoted and properly escaped in 
sql queries. The second form is vulnerable in this case.

$sql = mysql_query (SELECT * FROM tutor WHERE tutor_id='$tutor_id');
or
$sql = mysql_query (SELECT * FROM tutor WHERE tutor_id=$tutor_id);


What is the right way to define the variable $tutor_id 

--
For reference, I have copied the block of code below:
$dsn = mysql://root:[EMAIL PROTECTED]/tablename;

//connect to DB
$db = DB::connect ($dsn);
//check for any DB connection errors
   if (DB::isError ($db))
   die ($db-getMessage());
$action = $_GET[action];

$tutor_id = $_POST['tutor_id'];

print_r($_POST);

if($action == delete)
{
$sql = mysql_query (DELETE FROM tutor WHERE tutor_id='$tutor_id');
$result = $db-query($sql);

if( DB::isError($result) ) {
die ($result-getMessage());
}
echo a href='../index/timetable_main.php'Back to main/a;
}
if($action == edit)
{
$sql = mysql_query (SELECT * FROM tutor WHERE tutor_id='$tutor_id');
$row = mysql_fetch_array($sql);

echo form name=\edit_tutor\ method=\post\ action=\edit2.php\;
echo Tutor ID : .$row['tutor_id'].br;
echo input type=\hidden\ name=\tutor_id\ value=\.$row
['tutor_id'].\;
echo Name : input name=\tutor_name\ type=\text\ value=\.$row
['tutor_name'].\br;
echo Contact No : input type=\text\ name=\tutor_contact\ value=\.$row
['tutor_contact'].\br;
echo E-mail : input type=\text\ name=\tutor_email\ value=\.$row
['tutor_email'].\br;
echo Profile : input type=\text\ name=\tutor_profile\ value=\.$row
['tutor_profile'].\br;
echo input type=\submit\ name=\Submit\ value=\Update\;
echo /form;
}
?
echo The entry has been deleted brbr;

For reference, i have copied the block of code below:

Irin.
 

Jason has explained it to you: you are accessing a variable or an array 
index that has not been defined. Rethink your logic.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Undefined Index - is this how you declare get post?

2003-10-29 Thread Chris W. Parker
Terence mailto:[EMAIL PROTECTED]
on Wednesday, October 29, 2003 4:40 PM said:

 Since I started using error_reporting(E_ALL), I havent found (in my
 opinion) a good way to declare GET and POST variables when getting
 them from a form or querystring. I have searched google and the docs
 for several hours now without much luck.

Why would you want to declare a GET or POST variable in the first place?
You'd be overwriting whatever value was stored from the form.

Also, depending on your version of PHP you should be using $_GET and
$_POST and not $HTTP_GET_VARS or $HTTP_POST_VARS.


hth,
Chris.
--
Don't like reformatting your Outlook replies? Now there's relief!
http://home.in.tum.de/~jain/software/outlook-quotefix/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Undefined Index - is this how you declare get post?

2003-10-29 Thread Terence

- Original Message - 
From: Chris W. Parker [EMAIL PROTECTED]


 Terence mailto:[EMAIL PROTECTED]
 on Wednesday, October 29, 2003 4:40 PM said:

  Since I started using error_reporting(E_ALL), I havent found (in my
  opinion) a good way to declare GET and POST variables when getting
  them from a form or querystring. I have searched google and the docs
  for several hours now without much luck.

 Why would you want to declare a GET or POST variable in the first place?
 You'd be overwriting whatever value was stored from the form.

error_reporting(E_ALL) tells me that I have an indefined index, but as Jon
Kriek pointed out,
perhaps reporting all the errors is not such a good thing.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Undefined Index - is this how you declare get post?

2003-10-29 Thread John W. Holmes
Terence wrote:

Since I started using error_reporting(E_ALL), I havent found (in my opinion)
a good way to declare GET and POST variables when getting them from a form
or querystring. I have searched google and the docs for several hours now
without much luck.
?php
error_reporting(E_ALL);
// This line stops the error reporting, else I get - Notice: Undefined
index: i in.
$HTTP_GET_VARS[i]=;
if ($HTTP_GET_VARS[i] == ) {
 include(myfile.php);
}
?
Is there a better way?
I have tried var $i (only for classes I've discovered)
settype($i, integer)
Thanks in advance.

isset() is your friend.

if(isset($HTTP_GET_VARS['i'])  $HTTP_GET_VARS['i'] == '')
{ include('myfile.php'); }
This will not trigger any warning, even under E_ALL.

In response to some of the other posts, developing at E_ALL is a good 
idea as it'll help you spot potential problem areas.

Also, even though you have a form element defined, it may not always 
appear in $HTTP_GET_VARS/$_GET (post, etc). One example are checkboxes. 
If no boxes are checked, the variable is never created and this is the 
way to check.

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals  www.phparch.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Undefined index a different problem

2003-01-07 Thread Marek Kilimajer


Mekrand wrote:


my problem is,
i have a script that works well before php 4.2.3

its sth like that
{..

for($i=0; $icount($line); $i++); // loop line numbers
...
}

//2nd part
{
echo ($i);
}

now i changed second part as;

echo($GLOBALS[i]);


should not be

echo($GLOBALS[$i]);




and it gives me notice that undefined index i.
how can i solve this problem?
thanks




 



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Undefined index a different problem

2003-01-07 Thread Mekrand
thanks but this time it gives 2 error,
undefined variable i,
undefined index i for
$GLOBALS[$i]
Marek Kilimajer [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...


 Mekrand wrote:

 my problem is,
 i have a script that works well before php 4.2.3
 
 its sth like that
 {..
 
  for($i=0; $icount($line); $i++); // loop line numbers
 ...
 }
 
 //2nd part
 {
 echo ($i);
 }
 
 now i changed second part as;
 
 echo($GLOBALS[i]);
 
 should not be

 echo($GLOBALS[$i]);


 
 and it gives me notice that undefined index i.
 how can i solve this problem?
 thanks
 
 
 
 
 
 




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Undefined index a different problem

2003-01-07 Thread Marek Kilimajer
These are not errors, but notices, you can get around it using:
if(isset($i)  array_key_exists($GLOBALS, $i)) echo $GLOBALS[$i];

or you might prefer setting error_reporting to not display notices

Mekrand wrote:


thanks but this time it gives 2 error,
undefined variable i,
undefined index i for
$GLOBALS[$i]
Marek Kilimajer [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 

Mekrand wrote:

   

my problem is,
i have a script that works well before php 4.2.3

its sth like that
{..

for($i=0; $icount($line); $i++); // loop line numbers
...
}

//2nd part
{
echo ($i);
}

now i changed second part as;

echo($GLOBALS[i]);

 

should not be

echo($GLOBALS[$i]);


   

and it gives me notice that undefined index i.
how can i solve this problem?
thanks






 




 



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Undefined index a different problem

2003-01-07 Thread Matt Schroebel
Try:
echo($GLOBALS[$i]);

Or
echo {$GLOBALS[$i]};

This times it's the array in the double quoted strings ...

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] undefined index....property.

2002-12-16 Thread Martin Towell
you didn't send the code snippet for Undefined index
however, I think the reason you're getting these errors at home is because
you have a different error_reporting level.

HTH a bit
Martin

[snip]

//filled out info and clicked send.

Notice: Undefined index: license in c:\inetpub\wwwroot\php\config.php on
line 51

Notice: Undefined property: num_rows in
c:\inetpub\wwwroot\php\adcjoin.php on line 67


//

[snip]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Undefined index, Undefined variable, Undefined constant....

2002-09-06 Thread Jay Blanchard

[snip]
I'm having trouble with the newest version of PHP (4.2.2).
For example in a page I'm using the following code:
if ($_GET['action'] == logout) {
   //do something
}
[/snip]

As a quick troubleshooting method echo or print $_GET['action'] to see what,
if anything, is contained there. I would also like to see more than;

...log_message reports: PHP Notice:  Undefined index:  action in

HTH!

Jay

Here I am. Now what were your other two wishes?

*
* Texas PHP Developers Conf  Spring 2003*
* T Bar M Resort  Conference Center*
* New Braunfels, Texas  *
* Contact [EMAIL PROTECTED]   *
*   *
* Want to present a paper or workshop? Contact now! *
*



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Undefined index, Undefined variable, Undefined constant....

2002-09-06 Thread Meltem Demirkus

I had the say problem,
try this
if($_POST['update'] == Update)
{
someting to do...

}

- Original Message -
From: Jay Blanchard [EMAIL PROTECTED]
To: 'Jens Winberg' [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Friday, September 06, 2002 5:12 PM
Subject: RE: [PHP] Undefined index, Undefined variable, Undefined
constant


 [snip]
 I'm having trouble with the newest version of PHP (4.2.2).
 For example in a page I'm using the following code:
 if ($_GET['action'] == logout) {
file://do something
 }
 [/snip]

 As a quick troubleshooting method echo or print $_GET['action'] to see
what,
 if anything, is contained there. I would also like to see more than;

 ...log_message reports: PHP Notice:  Undefined index:  action in

 HTH!

 Jay

 Here I am. Now what were your other two wishes?

 *
 * Texas PHP Developers Conf  Spring 2003*
 * T Bar M Resort  Conference Center*
 * New Braunfels, Texas  *
 * Contact [EMAIL PROTECTED]   *
 *   *
 * Want to present a paper or workshop? Contact now! *
 *



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Undefined index error

2002-08-19 Thread Michael Sweeney

If you try to access a form variable that hasn't been set, you get an
undefined index. Try checking with something like 
if(isset($_POST['SortBy'])) {
   // do something with 'SortBy'
}

In any case, you'll get the undefined index warning anytime you try to
read an array index that hasn't been set.

..michael..

On Mon, 2002-08-19 at 14:49, Shu Chow wrote:
 I'm using the superglobal $_POST array to access URL 
 parameters passed to my page. I was getting undefined 
 constant errors in my error_log file, and found that I 
 needed to quote the variables in the array. 
   $_POST['SortBy'] etc. Now, it appears that I've just 
 traded the undefined constant errors for undefined index 
 warnings. Everytime a page hits a page with url 
 parameters, it triggers a warning in the error_log file. 
 What's triggering these undefined index errors? I suppose 
 I could lower the logging level in php.ini, but I'd rather 
 code properly than to hide the problem. Thanks!




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Undefined Index

2002-08-02 Thread Chris Hewitt

Jrgen wrote:


$op = $_GET['op'];
switch ( $op )

PHP shoots a Notice Message telling me that there is an undefined index
Undefined index: act in g:\apache_web\intern\looney\index.php on line 177

If there is not a get variable in the url you will get the warning.

Ok, am i correct in assuming that it pops this message because $op is not
defined as anything yet?

Yes,


If so,should i always just do this

$_POST['op'] = '';
$op = $_GET['op'];
switch ( $op )
{
//Code here
}

If there is not a get variable callled op you should still get the 
warning.

$op = isset($_GET['op']);
switch ( $op )
{
//Code here
}

Now $op will be a boolean assigned the value true (if there is a get 
variable called op in the url) or false if not. As $op will have a 
value then there is no warning.

What I tend to do when I have an optional item of data is:

if (isset($_GET[op])) [
$op = $_GET[op];
}
else
{
$op = no value;// set to something you can test for in 
your switch statement.
}
though there may be a better way.


Best regards from Vienna,
Jrgen

.. thanks, and best regards to you from Essex, England.

HTH
Chris



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Undefined index?

2001-07-11 Thread Philip Olson


If one has :

  $arr = array('a','b','c');

And calls upon the following :

  $arr[b]   (as opposed to $arr['b'])

Then the following will result :

Warning: Use of undefined constant b - assumed 'b' in ./tmp.php on line 13
Warning: Undefined index: b in ./tmp.php on line 13

Always use quotes around the keys/indexes within associative arrays
otherwise the constant is looked for first and unexpected results are
possible.  Now if we have (which you most likely did) :

  $arr['d']

Then we get the following as index 'd' does not exist within the array :

Warning: Undefined index: d in ./tmp.php on line 13

A similar error is created when doing this :

  echo $iamnotset;

  if ($iamnotset) {

Which results in :

Warning: Undefined variable: iamnotset in ./tmp.php on line 11

Using something similar to isset() helps combat that :

  if (isset($iamnotset)) {


All of the above errors (Notices) are of the E_NOTICE type.  If E_NOTICE
is turned on within the error_reporting setting within php.ini (or via a
call to the error_reporting() function or ...), then you'll see it
otherwise you will not.  I'm not sure why Notices say Warning: ... but
they do :-)

Typically one turns errors up during development, and down during
production use.  And, it's not uncommon to see this question come about
within various support forums/lists for various PHP applications.

Regards,
Philip


  -Original Message-
  From: Ivo Stoykov [mailto:[EMAIL PROTECTED]]
  Sent: 11 iulie 2001 17:21
  To: [EMAIL PROTECTED]
  Subject: [PHP] Undefined index?
  
  
  Hi everybody
  
  Does anybody knows what means Undefined index error? I 
  couldn't find it in
  docs neither in php online doc site.
  
  Thank you
  
  Ivo
  
  
  
  -- 
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: 
  [EMAIL PROTECTED]
  
  
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]