|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2002-09-19 05:41 UTC] sniper@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 02 03:00:01 2025 UTC |
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.