chandler Posted September 22, 2010 Share Posted September 22, 2010 When I add some text to the front end of the textarea it displays bla <br/> bla <br/> bla <br/> How can I stop it from showing the html tags? Thanks. echo'<textarea id="info" style="width:80%; height:60px;">'; } echo $profile['info']; if($_SESSION['user_id'] == $id) { echo'</textarea><input type="submit" style="width:70%" value="send" onclick="updateInterests(document.getElementById(\'info\').value)" />'; Quote Link to comment https://forums.phpfreaks.com/topic/214136-html-displaying-in-textarea/ Share on other sites More sharing options...
Andy-H Posted September 22, 2010 Share Posted September 22, 2010 echo'<textarea id="info" style="width:80%; height:60px;">'; } echo stripslashes( htmlentities($profile['info'], ENT_QUOTES) ); if($_SESSION['user_id'] == $id) { echo'</textarea><input type="submit" style="width:70%" value="send" onclick="updateInterests(document.getElementById(\'info\').value)" />'; stripslashes htmlentities Quote Link to comment https://forums.phpfreaks.com/topic/214136-html-displaying-in-textarea/#findComment-1114239 Share on other sites More sharing options...
chandler Posted September 22, 2010 Author Share Posted September 22, 2010 tried that still showing the tags though, im going to read up on those links you included. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/214136-html-displaying-in-textarea/#findComment-1114256 Share on other sites More sharing options...
Andy-H Posted September 22, 2010 Share Posted September 22, 2010 echo'<textarea id="info" style="width:80%; height:60px;">'; } $search = array('<br/>', '<br />', '<br>', '<br >'); $info = str_ireplace($search, "\r\n", $profile['info']); echo stripslashes( htmlentities($info, ENT_QUOTES) ); if($_SESSION['user_id'] == $id) { echo'</textarea><input type="submit" style="width:70%" value="send" onclick="updateInterests(document.getElementById(\'info\').value)" />'; stripslashes htmlentities Does that work, if it does, you need to use nl2br on the data when it's posted back. Quote Link to comment https://forums.phpfreaks.com/topic/214136-html-displaying-in-textarea/#findComment-1114264 Share on other sites More sharing options...
chandler Posted September 22, 2010 Author Share Posted September 22, 2010 no still getting the <br/> tag Quote Link to comment https://forums.phpfreaks.com/topic/214136-html-displaying-in-textarea/#findComment-1114270 Share on other sites More sharing options...
Andy-H Posted September 22, 2010 Share Posted September 22, 2010 echo'<textarea id="info" style="width:80%; height:60px;">'; } $search = array('<br/>', '<br />', '<br>', '<br >'); $info = str_ireplace($search, "\r\n", $profile['info']); echo strip_tags($info); if($_SESSION['user_id'] == $id) { echo'</textarea><input type="submit" style="width:70%" value="send" onclick="updateInterests(document.getElementById(\'info\').value)" />'; Quote Link to comment https://forums.phpfreaks.com/topic/214136-html-displaying-in-textarea/#findComment-1114272 Share on other sites More sharing options...
chandler Posted September 22, 2010 Author Share Posted September 22, 2010 great tags of gone, thank you so much Andy. Quote Link to comment https://forums.phpfreaks.com/topic/214136-html-displaying-in-textarea/#findComment-1114276 Share on other sites More sharing options...
Andy-H Posted September 22, 2010 Share Posted September 22, 2010 NO worries, got there in the end lol Quote Link to comment https://forums.phpfreaks.com/topic/214136-html-displaying-in-textarea/#findComment-1114277 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.