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"]]>? Link to comment https://forums.phpfreaks.com/topic/137415-solved-as-is-display/ 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 Link to comment https://forums.phpfreaks.com/topic/137415-solved-as-is-display/#findComment-718019 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... Link to comment https://forums.phpfreaks.com/topic/137415-solved-as-is-display/#findComment-718062 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? Link to comment https://forums.phpfreaks.com/topic/137415-solved-as-is-display/#findComment-718072 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}"); ?> Link to comment https://forums.phpfreaks.com/topic/137415-solved-as-is-display/#findComment-718087 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. Link to comment https://forums.phpfreaks.com/topic/137415-solved-as-is-display/#findComment-718180 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.