Re: Help please: undefined index in sample code

From: Date: Mon, 16 Jun 2003 13:30:05 +0000
Subject: Re: Help please: undefined index in sample code
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-20349@lists.php.net to get a copy of this message
thats rather sweet of luis thnx :) but it was somebody elses problem this time i was only replying to stephen :) ;) toby --- Luis Moreira <lamoreira@bes.pt> wrote: > Toby, > > If you write > > $tireqty = $_POST['tireqty'] > > you're telling PHP that the calling script is sending a variable > called > 'tireqty'. > Since on your case the name of the value and of the POST are the > same, I > mean that if you write > > $AFTER_POST = $_POST['VALUE_PASSED'] > > you will set a variable called $AFTER_POST to the value given by > the calling > form through the field named 'VALUE_PASSED' > Otherwise, you trying to get the value of a POST that never was. > > Check the names of the fields on the form, and as someone said, use > 'isset' > to see if something actually went trough > > Sorry to be so thorough, but it's just to be as clear as I can > > > Luis > > > ----- Original Message ----- > From: "Stephen" <stephen.edmonds5@btinternet.com> > To: "toby z" <blue_myth_1@yahoo.com> > Cc: "Windows Helplist (PHP)" <php-windows@lists.php.net> > Sent: Monday, June 16, 2003 1:58 PM > Subject: Re: [PHP-WIN] Help please: undefined index in sample code > > > > Toby, $_POST should exist even if register globals are on! Thats > why I > said > > it would probably be nothing to do with it. > > > > Unless I am mistaken > > > > Stephen > > > > ----- Original Message ----- > > From: "toby z" <blue_myth_1@yahoo.com> > > To: "Stephen" <stephen.edmonds5@btinternet.com> > > Cc: "Windows Helplist (PHP)" <php-windows@lists.php.net> > > Sent: Monday, June 16, 2003 10:37 AM > > Subject: Re: [PHP-WIN] Help please: undefined index in sample > code > > > > > > > my dear man > > > if u try > > > > > > >> $tireqty = $_POST['tireqty']; > > > > > > with register globals on > > > > > > it gives u the same error :) > > > > > > i didn ask that without any reazon > > > > > > toby > > > > > > --- Stephen <stephen.edmonds5@btinternet.com> wrote: > Which > just > > > goes to show some people will say anything... > > > > > > > > I don't think this has anything to do with register globals > (Sorry > > > > toby). > > > > Undefined index sounds like php is just warning you that you > are > > > > using a > > > > variable without a value. Since you are using a form to send > data, > > > > this can > > > > occur. To be honest, its a fairly pointless warning, so you > > > > probably want to > > > > ignore it. In your php.ini file search for and find the > > > > error_reporting > > > > option. I recommend you change your settings to > > > > error_reporting = E_ALL & ~E_NOTICE > > > > This should solve your problem. > > > > > > > > ----- Original Message ----- > > > > From: "Stuart Felenstein" <stuart4m@yahoo.com> > > > > To: <php-windows@lists.php.net> > > > > Sent: Saturday, June 14, 2003 10:18 AM > > > > Subject: Re: [PHP-WIN] Help please: undefined index in sample > code > > > > > > > > > > > > > Yes, register globals are now on. Though it doesn't > apparently > > > > matter. > > > > > > > > > > Stuart > > > > > > > > > > toby z <blue_myth_1@yahoo.com> wrote: > > > > > register globals on or off ????? > > > > > > > > > > --- Stuart Felenstein wrote: > I can't believe > > > > > Chapter 1 , section 1 and I'm off to a bad start > > > > > > already. > > > > > > Using this form and script, I keep getting "undefined > index" > > > > for > > > > > > the variables I declare in the script. Running PHP 4.3.2 > on XP > > > > > > Pro. Thanks. > > > > > > Stuart > > > > > > > > > > > > Form: > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Item > > > > > > Quantity > > > > > > > > > > > > > > > > > > Tires > > > > > > [input] > maxlength="3"> > > > > > > > > > > > > > > > > > > Oil > > > > > > [input] > maxlength="3"> > > > > > > > > > > > > > > > > > > Spark Plugs > > > > > > [input] > maxlength="3"> > > > > > > > > > > > > > > > > > > [input] > Order"> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Script: > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Bob's Auto Parts > > > > > > Order Results > > > > > > > //create short variable names > > > > > > $tireqty = $_POST['tireqty']; > > > > > > $oilqty = $_POST['oilqty']; > > > > > > $sparkqty = $_POST['sparkqty']; > > > > > > ?> > > > > > > > echo ' > > > > > Your order is as follows: > > > > > '; > > > > > > echo $tireqty.' tires > > > > > '; > > > > > > echo $oilqty.' bottles of oil > > > > > '; > > > > > > echo $sparkqty.' spark plugs > > > > > '; > > > > > > ?> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > ________________________________________________________________________ > > > > > Want to chat instantly with your online friends? Get the > FREE > > > > Yahoo! > > > > > Messenger http://uk.messenger.yahoo.com/ > > > > > > > > > > > > > > > > -- > > > > PHP Windows Mailing List (http://www.php.net/) > > > > To unsubscribe, visit: Ö„Ž]íÒ > > > > zÊü Q”http://www.php.net/unsub.php > > > > > > > > > > > ________________________________________________________________________ > > > Want to chat instantly with your online friends? Get the FREE > Yahoo! > > > Messenger http://uk.messenger.yahoo.com/ > > > > > > > > > > > -- > > PHP Windows Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > -- > PHP Windows Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > ________________________________________________________________________ Want to chat instantly with your online friends? Get the FREE Yahoo! Messenger http://uk.messenger.yahoo.com/

« previous php.windows (#20349) next »