Re: PHP Scripting errors

From: Date: Thu, 15 May 2003 00:29:26 +0000
Subject: Re: PHP Scripting errors
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-19932@lists.php.net to get a copy of this message
Thanks to the people who suggested turning register_globals to On. My host does have this enabled. I opened my php.ini from my windows directory and changed register_globals = Off to register_globals = On. I restarted Apache several times and rebooted my computer twice but everytime I run phpinfo() it still reports it as being Off. Can anyone tell me what I am missing. Thanks again! -Adam Reiswig JanetVal@aol.com wrote:
In a message dated 5/13/2003 6:12:42 PM Pacific Daylight Time, lists-php@honorcomputers.com writes:
I have just installed php (along with mysql and apache) on my windows 2K machine and everything seemed to be working correctly. I ran phpinfo() and it returned exactly what I would expect. Possibly since this is my first install of php ever I may not know what I should be looking for. When I ran a form that passed two variables to a receiving php page the page rendered correctly minus the data that should have showed up. I used "get" to pass the variable data and the correct variables were in the url string but not on the page itself. When I posted the two pages at my website (its hosted and I expect set up correctly) the script ran as it should. The data was in the URL and on the page. Below is the form code and then after is the receiving php code. ***** welcomeform.html ***** <head><title>Welcome Form</title></head> <form action="welcome.php" method="get"> First Name: <input type="text" name="firstname" id="firstname" /> Last Name: <input type="test" name="lastname" id="lastname" /> <input type="submit" value="GO!" /> </form> ***** welcome.php ***** <?php echo "Welcome to my Website, $firstname $lastname!" ; ?> If anyone knows why my scripts are running correctly at my hosted site but not locally I'd be very grateful for any pointers. Thanks a lot.
The problem you are having is probably because you have register_globals turned off. You can change register_globals to On in your php.ini file. Or, you can get the variable using the built-in arrays as follows, $_GET['firstname'], rather than just $firstname. The arrays are more secure, and are always available (in PHP versions prior to 4.1, you would use $HTTP_GET_VARS['firstname']). You host probably has register_globals on, which is why your program works there. Janet


« previous php.windows (#19932) next »