|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19489 using html entities
Submitted: 2002-09-19 00:39 UTC Modified: 2002-09-19 05:41 UTC
From: nando at aboutown dot ca Assigned:
Status: Not a bug Package: Variables related
PHP Version: 4.2.0 OS: red hat 7.2
Private report: No CVE-ID: None
 [2002-09-19 00:39 UTC] nando at aboutown dot ca
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.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-09-19 05:41 UTC]
Sorry, but the bug system is not the appropriate forum for asking
support questions. Your problem does not imply a bug in PHP itself.
For a list of more appropriate places to ask for help using PHP,
please visit

Thank you for your interest in PHP.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Mon Dec 04 04:01:27 2023 UTC