Chappers Posted July 12, 2007 Share Posted July 12, 2007 Hi, Having some problems regarding quotes. I'm taking an entry from the MySQL table in the format 5'11" (as in five feet eleven inches). This is my variable $height. $height = $row['height']; Then I place it in a form which can be edited, which is inside an echo container: echo " <td><span class=\"n\">Height:</span></td> <td><input class=\"n2\" type=\"text\" name=\"height\" maxlength=\"100\" value=\"$height\"></td> "; Which displays the height without the quote mark for inches, i.e. 5'11 So I thought I'd try a replace: $height = $row['height']; $height2 = str_replace('"','\"',$height); But that just outputs: 5'11\ What's the usual way around this, considering that the height variable contains both single and double quote marks? I know one can use echo ?> then the HTML and add variables with <?php echo $height ?> so double quotes are still usable, but since the elements use quotes as delimiters, like value="height", how can another double quote be added in there without it thinking it's the delimiter. There must be a way around this? I found one webpage that stated putting two single quotes will output just one when entering the information into a MySQL database, but that's as far as I got with help on the net. Thank you to any and all who take this question on. James Quote Link to comment Share on other sites More sharing options...
per1os Posted July 12, 2007 Share Posted July 12, 2007 replace " with " Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.