Re: [PHP] re: Undefined Variable
Smart Software wrote: while(query )//here the query is opened { table tr td ?php query-name ? /td // record from database td Please fill in your age:/td //text td input name=age type=text /td //textbox, td a href=? echo otherform.php?age=PLACE_HERE_THE_VALUE_FROM_QUANTITY_TEXTBOXname=query-name; ? /td /tr /table } Actually a Javascript question, but I seem to be in a rare good mood today, so you're in luck. In the snippet below I've also fixed some syntax issues that tell me you really don't know what you're doing. On the other hand it could just be what you wrote in the email and not what you are actually trying to run. Either way I suggest you Google for a beginners tutorial on PHP to learn some basics. ?php $counter = 0; while(query) //here the query is opened [Stut: If you say so!] { ? table tr td?php $query-name ?/td // record from database tdPlease fill in your age:/td //text tdinput id=age?=$counter? name=age type=text/td //textbox, tda href=# onclick=location.href = 'otherform.php?age=' + document.getElementById('age?=$counter?').value + 'name=?=urlencode($query-name)?'; return false;Save Age/a/td /tr /table ?php $counter++; } ? What this is doing is assigning an ID to each age textbox, that allows the onclick handler for the link (which you had not closed properly or given some text to display) to get the value and add it to the URL it links to. I suggest you run this and compare the source file and the output to see what is server-side and what is client-side, because I don't think you understand the difference yet. Enjoy. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] re: undefined variable
Original Message Subject: [PHP] re: undefined variable From: Smart Software [EMAIL PROTECTED] Date: Sun, April 30, 2006 1:50 pm To: php-general@lists.php.net //get content of textbox $q = isset($_REQUEST['$textbox']) ? $_REQUEST['$textbox'] : 0; You should use $_REQUEST[$textbox] or $_REQUEST[$textbox]. Variables are not converted within a single-quoted string. HTH, Ray -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: undefined variable
On Sun, April 30, 2006 6:17 am, Smart Software wrote: while(query )//here the query is opened Please, JUST post your real code in http://pastebin.com or something! We CANNOT figure out what the [bleep] you really have from this! { table tr td ?php query-name ? /td // record from database td Please fill in your age:/td //text td input name=age type=text /td //textbox, td a href=? echo otherform.php?age=PLACE_HERE_THE_VALUE_FROM_QUANTITY_TEXTBOXname=query-name; ? /td /tr /table } how can i get the value from the textbox? i don't have form tag if i have 50 records, there are 50 textboxes named age right? If you want 30 boxes named 'age', then you should name them like: name=age[] or, possible, name=age[42] where 42 is the ID of the record whose age is being displayed/input. -- 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
[PHP] Re: Undefined Variable Problems...
Nick Zukin wrote: ... line 79, if ($forum_admin == 1) { line 486, $uname = $cookie[1]; line 216, $pwd = $user[2]; Line 79 is not part of a function or class. It is the first reference to $forum_admin in the script. The other two are within functions and the first call within those functions. What's being assigned to both of them are either in the function call itself or globals. I do have globals turned on. you mean register_globals? Turn it off unless this breaks things in a major way... even then you should consider recoding if that's feasible. Should I worry about any of this? The pages seem to be working fine? Is this going to slow things down? Should I just turn off the logging of such errors, if I can? uninitialized variables + register_globals is usually a bad combination... especially when we're talking about a varaible like $forum_admin. http://.com/forums/post.php?forum_admin=1user=whoever In a simple case the above can happen and someone gains admin rights... in worse cases you end up with SQL code dropping databases... Thanks for any help. My log files are in the gigabytes with 90% of that over the last month. ignoring the E_NOTICE errors is a good idea on a production site anyway. That being said... I would try to fix the code so that the notice doesn't get produced in the first place. -- Teach a man to fish... NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-generalw=2 STFM | http://php.net/manual/en/index.php STFW | http://www.google.com/search?q=php LAZY | http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins signature.asc Description: OpenPGP digital signature
[PHP] Re: Undefined Variable Problems...
Please keep responses on the mailing list / newsgroup... Nick Zukin wrote: Thanks for the quick response. Yes, had to turn register_globals on because it broke things. Many of these sites aren't mine and I have no idea what's involved in trying to fix them all. If you saw a full 1.2 GB error log (per domain) that built up to that size in less than a month, though, you'd see that it would take a lot of re-coding. Assuming I can fix the pages that break when register_globals turned off, how big a deal are the undefined variables? If you can manage to turn register_globals off that would be the most important thing. Undefined variables aren't necessarily bad, but they can lead to obscure bugs (for example, if a variable is set inside of an included file instead of a main script where you thought it was unset). signature.asc Description: OpenPGP digital signature
RE: [PHP] Re: Undefined Variable Problems...
Sorry, as I said, I just joined and I didn't notice that it's set to reply-to the original sender rather than the list. A bit annoying. Thanks again. Nick -Original Message- From: Jason Barnett [mailto:[EMAIL PROTECTED] Sent: Sunday, March 06, 2005 1:10 PM To: php-general@lists.php.net Subject: [PHP] Re: Undefined Variable Problems... Please keep responses on the mailing list / newsgroup... Nick Zukin wrote: Thanks for the quick response. Yes, had to turn register_globals on because it broke things. Many of these sites aren't mine and I have no idea what's involved in trying to fix them all. If you saw a full 1.2 GB error log (per domain) that built up to that size in less than a month, though, you'd see that it would take a lot of re-coding. Assuming I can fix the pages that break when register_globals turned off, how big a deal are the undefined variables? If you can manage to turn register_globals off that would be the most important thing. Undefined variables aren't necessarily bad, but they can lead to obscure bugs (for example, if a variable is set inside of an included file instead of a main script where you thought it was unset). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Undefined Variable Problems...
Also, since this is a very massive list with high traffic, quote when necessary. For example, consider this message: Can i draw something ? Yes you can Thanks You're welcome In that case quote is quite useful :D -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: undefined variable notice - how to furn of
Everything works fine, just now I'm getting Notice messages for every undefined variable or undefined index in arrays.. So now I have to use issset() everytime to avoid this messages... you would initialize your variables in the beginning of your scripts. With that, you don't need isset(). ..is there any way to turn this messages off, because if prior versions I never got them..?? ok, the other guys have answered with error_reporting(E_ALL ~E_NOTICE) or error_reporting(E_NONE). But don't you think it would be a best practice to set error reporting to E_ALL and initialize your variables ? your script would work, regardless of the configuration of php.ini, and would be more portable. error_reporting(E_ALL) and register_globals = off are IMHO a good way to have better code. In fact, I use error_reporting(E_ALL) on my test server, and error_reporting(E_NONE) (or a file log) on the production one. Best regards, Philippe -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Undefined Variable
Adriano Santos wrote: Hi, I'm with problem: Undefined Variable. I'm using : PHP 4.2.3 MySql 3.2.39 Windows 2000 How do I make to soluction my problem ? at the top of your script: error_reporting(E_ALL ~E_NOTICE); or initialize your variables likes: $number = 0; $string = foo; Derick -- - Derick Rethans http://derickrethans.nl/ PHP Magazine - The PHP Magazine for Professionals - http://php-mag.net/ - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Undefined Variable
My php.ini: error_reporting = E_ALL ~E_NOTICE I have a form to send of the variables, but my page do not receive values. This my code: ?php $nome = StrToLower($nome); $senha = StrToLower($senha); ? thanks Derick Rethans [EMAIL PROTECTED] escreveu na mensagem [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Adriano Santos wrote: Hi, I'm with problem: Undefined Variable. I'm using : PHP 4.2.3 MySql 3.2.39 Windows 2000 How do I make to soluction my problem ? at the top of your script: error_reporting(E_ALL ~E_NOTICE); or initialize your variables likes: $number = 0; $string = foo; Derick -- - Derick Rethans http://derickrethans.nl/ PHP Magazine - The PHP Magazine for Professionals - http://php-mag.net/ - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Undefined Variable
Adriano Santos wrote: My php.ini: error_reporting = E_ALL ~E_NOTICE I have a form to send of the variables, but my page do not receive values. This my code: ?php $nome = StrToLower($nome); $senha = StrToLower($senha); ? I guess you use PHP 4.2.0+; since this version the register_globals setting defaults to off. See http://www.php.net/release_4_2_0.php for more info. This change was necessary as part of our efforts to make PHP scripting more secure and portable. -- - Derick Rethans http://derickrethans.nl/ PHP Magazine - The PHP Magazine for Professionals - http://php-mag.net/ - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Undefined Variable
Thanks.
[PHP] Re: Undefined variable
Hi, thanks for the help! I worked, but i dont get it, why use $_POST['name'] or $_GET['name'] when the text from the internet and books I've read says just put a dollar sign before the variable's name. If it wouldn't be a burden can u pls xplain? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Undefined variable
Hi, Muhammad Khairuzzaman wrote: Hi, thanks for the help! I worked, but i dont get it, why use $_POST['name'] or $_GET['name'] when the text from the internet and books I've read says just put a dollar sign before the variable's name. from php version 4.?.x on register_globals is turned off by default in your php.ini so you can't use the posted variables (or the ones passed by url) by just putting a $ at the beginning of the variable name. cheers J -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Undefined variable
Muhammad Khairuzzaman [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I worked, but i dont get it, why use $_POST['name'] or $_GET['name'] when If you set a variable inside your script called $validuser=true, how would you know if that was POSTed to your script or I added secretpage.php?validuser=true to the URL? Bet you wouldn't have checked... - Steve Yates - Can taglines have sequels? Hmmm. ~ Do you like my taglines? Add them to your messages and ~ laugh through hundreds more by downloading Taglinator ~ at www.srtware.com today! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Undefined Variable in IF...ELSE IF ...ELSE IF (NEWBIE ?)
I have error's enabled in php.ini. I keep getting Undefined variable when I run a script that contains IF or ELSE IF's. Is this normal because the variable hasn't been set at the beginning of the script ? Yes. If the variable hasn't been defined previously you'll get a warning: if ( $dd 2) true; Will warn unless $dd is initialized prior to the if(). Charlie -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Undefined Variable in IF...ELSE IF ...ELSE IF (NEWBIE?)
On Fri, 15 Mar 2002, Daniel Negron/KBE wrote: Thank You Charlie. I also found out that I needed to put an symbol infrom of the string. This stopped it from throwing me an error. If($submit) blah blah blah Better yet, use: if (isset($submit)) blah blah blah That explicitly checks to see whether the variable has been defined previously in the run, which makes your code easier to understand and avoids the klugey . miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Undefined Variable in IF...ELSE IF ...ELSE IF (NEWBIE ?)
I have been sloppy in teh past and just used if($submit) blah blah blah not sure of ramifications, but seems to work unless $submit is false or not set. again, take with grain of salt, other suggestions (especially isset) are much more certain. Dave -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, March 15, 2002 3:46 PM To: Daniel Negron/KBE Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Re: Undefined Variable in IF...ELSE IF ...ELSE IF (NEWBIE ?) On Fri, 15 Mar 2002, Daniel Negron/KBE wrote: Thank You Charlie. I also found out that I needed to put an @ symbol infrom of the string. This stopped it from throwing me an error. If(@$submit) blah blah blah Better yet, use: if (isset($submit)) blah blah blah That explicitly checks to see whether the variable has been defined previously in the run, which makes your code easier to understand and avoids the klugey @. miguel -- 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