andibakker Posted September 16, 2009 Share Posted September 16, 2009 Hi I am selecting a field sponsorname from a mysql table. The sponsor name is Johny's sponsor. I then want to display it in a textbox field for update. Below are the relevant lines of code. The code below works fine for a sponsor name of jan v/d merwe, but doesn't work for johny's. $sponsorresult = mysql_query( 'SELECT sponsorname from sponsor WHERE ....'); list($sponsorname) = mysql_fetch_array($sponsorresult); $defaults['sponsorname'] = htmlentities($sponsorname); . . <p class="bigtext">Sponsor Name<br/><input type="text" name="sponsorname" maxlength="30" value='<?php echo $defaults['sponsorname'] ?>'/> it doesn't display anything after the ' Link to comment https://forums.phpfreaks.com/topic/174425-solved-display-field-from-database-with-a-quote-in-a-textbox/ Share on other sites More sharing options...
Bricktop Posted September 16, 2009 Share Posted September 16, 2009 Hi andibakker, Have a look at the htmlentities manual here http://us3.php.net/manual/en/function.htmlentities.php, in particular the 'quote_style' parameter. Change the following line of code to read: $defaults['sponsorname'] = htmlentities($sponsorname, ENT_QUOTES); Link to comment https://forums.phpfreaks.com/topic/174425-solved-display-field-from-database-with-a-quote-in-a-textbox/#findComment-919369 Share on other sites More sharing options...
andibakker Posted September 16, 2009 Author Share Posted September 16, 2009 thanks - that solves it Link to comment https://forums.phpfreaks.com/topic/174425-solved-display-field-from-database-with-a-quote-in-a-textbox/#findComment-919380 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.