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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.