p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 (http://p2p.wrox.com/forumdisplay.php?f=123)
-   -   Chapter 12 - useraccount.php (http://p2p.wrox.com/showthread.php?t=17843)

buzzuh September 2nd, 2004 09:36 PM

Chapter 12 - useraccount.php
 
Starting from the admin page.
I click on user I want to administer.
The "Modify Account" page is displayed.

The form field for name will only display the Admin name, and not the user I am modifying. I know at the top of the page the variables emptied. but for some reason the variable for name is not being assigned the proper value by the array. I tried some echos to see what the variable values were after they were assigned by the array. (echos were after the call to the header.php file. Every other value that is being returned is correct except for the name. I check the MySQL tables and every thing looks correct. I only have one admin, and one user in the db at this time. The only way I can seem to get the form field to display the users name that I am attempting to modify is to change the variable from $name to $uname as follows:

Code:

$name = $row['name'];
to
Code:

$uname = $row['name'];
And

Code:

echo htmlspecialchars($uname);
in the input field value setting.

Can someone explain why the variable $name is not being assigned properly by the query? Is the $name variable being somehow overwritten from the session?


There is no such thing as a stupid question, unless you ask it more than once :)

jason.gerner September 3rd, 2004 08:49 AM

One thing to look at: check your php.ini file to see if register_globals is enabled. If so, disable them.


buzzuh September 3rd, 2004 02:48 PM

Yes register_globals is off. PHP Version is 4.3.8, therefore its off by defauilt. I checked to be sure that it was off.

There is no such thing as a stupid question, unless you ask it more than once :)

buzzuh September 3rd, 2004 02:53 PM

Nevermind that last post. register_globals is off on my test server. BUT, it is on at my hosted site. have not clue why they changed the default to on its the same version I have on my local test server. anyhow, as soon as I added an htaccess file that turned register_globals off to the folder this script resides in, it worked fine. thanks!

There is no such thing as a stupid question, unless you ask it more than once :)


All times are GMT -4. The time now is 07:55 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.