From:             [EMAIL PROTECTED]
Operating system: red hat 7.2
PHP version:      4.2.0
PHP Bug Type:     Variables related
Bug description:  using html entities

I am using PHP/MySQL for login to a system I'm writing.

Here's an enable of reading a record from MySQL and creating a table in a
web page...

        if ($row=mysql_fetch_array($result,MYSQL_BOTH)) 
                {
                        $old_name1              = $row["username"];
                        $old_ability1           = $row["ability"];
                        $old_comments1  = $row["comments"];
                        $old_password1  = $row["password"];
                        $old_created            = $row["created"];
                        $old_modified           = $row["modified"];
                        $user_id                = $row["userid"];

                        $old_name               =htmlentities($old_name1);
                        $old_password           =htmlentities($old_password1);
                        $old_ability            =htmlentities($old_ability1);
                        $old_comments   =htmlentities($old_comments1);

                        echo"<TR height=15></TR>";
                        echo"<TR><TD align=right 
valign=top><B>Username</B></TD><TD><input
type=text name=new_name size=30 value=$old_name></TD></TR>";
                        echo"<TR><TD align=right 
valign=top><B>Password</B></TD><TD><input
type=password name=new_password size=30 value=$old_password></TD></TR>";
                        echo"<TR><TD align=right 
valign=top><B>Ability</B></TD><TD><textarea
name=new_ability cols=80 rows=3>$old_ability</textarea></TD></TR>";
                        echo"<TR><TD align=right
valign=top><B>Created</B></TD><TD>$old_created</TD></TR>";
                        echo"<TR><TD align=right
valign=top><B>Modified</B></TD><TD>$old_modified</TD></TR>";
                        echo"<TR><TD align=right 
valign=top><B>Comments</B></TD><TD><textarea
name=new_comments cols=80 rows=15>$old_comments</textarea></TD></TR>";
                        echo"<TR height=15></TR>";

                        echo"<input type=hidden name=userid value=$user_id>";
                        echo"<input type=hidden name=old_name value=$old_name1>";
                        echo"<input type=hidden name=old_ability 
value=$old_ability1>";

                        echo"<input type=hidden name=old_created value=$old_created>";
                        echo"<input type=hidden name=old_modified 
value=$old_modified>";  
        //use these 2 hiddens to determine change since edit by someone else and
not save changes

                        echo"<input type=hidden name=userid value=$user_id>";
                        echo"<input type=hidden name=silly value=$old_comments>";
                        echo"<input type=hidden name=old_name value=$old_name>";
                        echo"<input type=hidden name='old_comments' 
value=$old_comments>";
                        echo"<input type=hidden name=old_password 
value=$old_password>";


To get HTMLENTITES to work propery, I found out I must
use HTMLENTITES and assign to a new variable.  It I use
the same variable [as in $old_name=HTMLENTITIES($old_name)]
then PHP does not create the correct page.
When I use a different var on the left of the equal sign,
then it works.
Very wierd.




-- 
Edit bug report at http://bugs.php.net/?id=19489&edit=1
-- 
Try a CVS snapshot:  http://bugs.php.net/fix.php?id=19489&r=trysnapshot
Fixed in CVS:        http://bugs.php.net/fix.php?id=19489&r=fixedcvs
Fixed in release:    http://bugs.php.net/fix.php?id=19489&r=alreadyfixed
Need backtrace:      http://bugs.php.net/fix.php?id=19489&r=needtrace
Try newer version:   http://bugs.php.net/fix.php?id=19489&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=19489&r=support
Expected behavior:   http://bugs.php.net/fix.php?id=19489&r=notwrong
Not enough info:     http://bugs.php.net/fix.php?id=19489&r=notenoughinfo
Submitted twice:     http://bugs.php.net/fix.php?id=19489&r=submittedtwice
register_globals:    http://bugs.php.net/fix.php?id=19489&r=globals

Reply via email to