Jump to content

tags issue?


timtom1

Recommended Posts

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>');

}

}

?>

Link to comment
https://forums.phpfreaks.com/topic/89804-tags-issue/
Share on other sites

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>");

}

}

?>

 

 

Link to comment
https://forums.phpfreaks.com/topic/89804-tags-issue/#findComment-460237
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.