php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #20837 Undefined variable notice
Submitted: 2002-12-05 15:20 UTC Modified: 2002-12-05 15:29 UTC
From: webmaster at vop dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 4.2.3 OS: Windows XP professional
Private report: No CVE-ID: None
 [2002-12-05 15:20 UTC] webmaster at vop dot com
I downloaded the latest PHP version hoping that it will work, but everytime I try to run PHP script it won't run, it will say undefined variable,

especially when I use form, when I clicked submit the php won't recognize the variable from the form.

I unstalled the 4.2.3 and installed the 4.06 and the problem solved.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-12-05 15:29 UTC] derick@php.net
In PHP 4.2.0, the 'register_globals' setting default changed to
'off'. See http://www.php.net/release_4_2_0.php for more info.
We are sorry about the inconvenience, but this change was a necessary
part of our efforts to make PHP scripting more secure and portable.
 [2004-01-09 11:54 UTC] parkhurst at mac dot com
I am having the same issue and changing register_globals to "On" does not help.  The OS is Windows XP Professional and I have PHP 4.3.4.

For now I am just going to downgrade to 4.0.6 because I can't work with this issue it is becoming a big problem.
 [2004-01-09 12:00 UTC] parkhurst at mac dot com
Some more notes about the issue.  Even if I have a script as simple as this it will not work properly.

---
<?php if (!$text) { $text = "Enter Text Here"; } ?>
<form action="temp.php" method="post" enctype="multipart/form-data" name="form1">
  <input name="text" type="text" id="text" value="<?php echo $text; ?>">
  <input type="submit" name="Submit" value="Submit">
</form>
---

This is the error message it gives me.  I see that there are a number of reports of similar problems.  Here is the error message it returns....

Notice: Undefined variable: text in d:\---filepath---\temp.php on line 1
 [2004-01-09 13:34 UTC] papercrane at reversefold dot com
I'm sure this is about to be set bogus as this isn't an error with PHP.

That's a Notice, first of all, not an error. A Notice is just for your own enlightenment. The problem is that you're using a variable that's not defined and that generates a notice. You can fix this in one of a multitude of ways. The first and easiest is to turn off notices. In your php.ini file, set

error_reporting = E_ALL & ~E_NOTICE

This will stop notices from being displayed, but this will just stop the symptom.

The better way is to use this in your script:

if(!isset($text)) { $text = 'blah'; }



Please refrain from posting bugs unless you KNOW FOR CERTAIN that it is a bug. It is much better to post to a newsgroup or mailing list for help rather than submitting a bug (as normally, you get NO help when submitting a bogus bug).

See http://www.php.net/support.php
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 06:01:30 2024 UTC