timtom1 Posted February 6, 2008 Share Posted February 6, 2008 I have writen a very basic upload script that is like this fourm page that allows you to add options to make the text bold ect but it does not come out right. in the database it displays as < b >text < / b > and it also echo's like that too how do I make it so that it is bold and not display tags in the text? // Execute the query to retrieve articles $result = $connector->query('SELECT * FROM cmshome'); $row = $connector->fetchArray($result); // Check whether a form has been submitted. If so, carry on if ($HTTP_POST_VARS){ // IMPORTANT!! ADD FORM VALIDATION CODE HERE // Update db - need to validate so can't send blank $main_txt = (addslashes($_POST['main_txt'])); $updateQuery = "UPDATE cmshome SET main_txt='$main_txt'"; // Save the form data into the database if ($result = $connector->query($updateQuery)){ // It worked, give confirmation echo '<center><b>Main Page Updated</b></center><br>'; }else{ // It hasn't worked so stop. Better error handling code would be good here! exit('<center>Sorry, there was an error saving to the database</center>'); } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/89804-tags-issue/ Share on other sites More sharing options...
budimir Posted February 6, 2008 Share Posted February 6, 2008 Try this <?php // Execute the query to retrieve articles $result = $connector->query('SELECT * FROM cmshome'); $row = $connector->fetchArray($result); // Check whether a form has been submitted. If so, carry on if ($HTTP_POST_VARS){ // IMPORTANT!! ADD FORM VALIDATION CODE HERE // Update db - need to validate so can't send blank $main_txt = (addslashes($_POST['main_txt'])); $updateQuery = "UPDATE cmshome SET main_txt='$main_txt'"; // Save the form data into the database if ($result = $connector->query($updateQuery)){ // It worked, give confirmation echo "<center><b>Main Page Updated</b></center><br>"; }else{ // It hasn't worked so stop. Better error handling code would be good here! exit("<center>Sorry, there was an error saving to the database</center>"); } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/89804-tags-issue/#findComment-460237 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.