elite_prodigy Posted December 17, 2008 Share Posted December 17, 2008 I don't want users to have to enter a <br /> every time they need a new line. And I certainly don't want to enter them into the string using string searching and replacing. So, how would I put data on a page that was entered through a form and have it's original integrity retained like this forum? <![CDATA["text"]]>? Quote Link to comment Share on other sites More sharing options...
Mchl Posted December 17, 2008 Share Posted December 17, 2008 Use nl2br function to convert linebreaks int br tag Quote Link to comment Share on other sites More sharing options...
elite_prodigy Posted December 17, 2008 Author Share Posted December 17, 2008 That doesn't work at all... Quote Link to comment Share on other sites More sharing options...
.josh Posted December 17, 2008 Share Posted December 17, 2008 ..or maybe you aren't using it correctly? Quote Link to comment Share on other sites More sharing options...
elite_prodigy Posted December 17, 2008 Author Share Posted December 17, 2008 how else do i use it? here is the code where it is used: <?php session_start(); if(!isset($_SESSION['id'])){ header("location:login.php"); } include 'config.php'; include 'functions.php'; mysql_select_db('exembar_site'); $id = $_SESSION['id']; $sql = "SELECT * FROM `permissions` WHERE `staffId`='{$id}'"; $result = mysql_query($sql); $info = mysql_fetch_array($result); $pages = $info['pages']; if($pages == 0){ header("location:{$root}/index.php"); } $title = $_POST['title']; $display = $_POST['display']; $top = $_POST['topbar']; $content = $_POST['content']; $id = $_GET['id']; //sanitize everything $title = sanitize($title); $display = sanitize($display); $top = sanitize($top); $content = sanitize($content); $content = nl2br($content); $sql = "UPDATE `navigation` SET `display`='{$display}' WHERE id='{$id}'"; mysql_query($sql) or die(mysql_error()); $sql = "UPDATE `pages` SET `title`='{$title}' WHERE `navId`='{$id}'"; mysql_query($sql) or die(mysql_error()); $sql = "UPDATE `pgContent` SET `topBar`='{$top}', `content`='{$content}' WHERE `navId`='{$id}'"; mysql_query($sql) or die(mysql_error()); header("location:{$root}"); ?> Quote Link to comment Share on other sites More sharing options...
Mchl Posted December 17, 2008 Share Posted December 17, 2008 nl2br is used when displaying data retrieved from database, not when storing it. 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.