I'm trying to insert our HR Policy into MySql, section by section.
I'm having trouble displaying it on the screen with the proper formatting.
Can someone help me clarify the proper way to take a paragraph of text, insert it into the database. Then retrieve it and display it on the screen with all the proper formatting.
Here's what I'm currently doing.
Here is a sample paragraph
"In order to avoid the awkward use of “he/she”, “him/her”, and “his/her” when referring to employees, the use of the masculine pronoun in these rules shall be interpreted to include the feminine."
I'm inserting it with
Then here is the code to retrieve the data.
Here is what the text looks like in the database now
"In order to avoid the awkward use of “he/sheâ€, “him/herâ€, and “his/her†when referring to employees, the use of the masculine pronoun in these rules shall be interpreted to include the feminine."
please help, I'm definitely doing something wrong.
I'm having trouble displaying it on the screen with the proper formatting.
Can someone help me clarify the proper way to take a paragraph of text, insert it into the database. Then retrieve it and display it on the screen with all the proper formatting.
Here's what I'm currently doing.
Here is a sample paragraph
"In order to avoid the awkward use of “he/she”, “him/her”, and “his/her” when referring to employees, the use of the masculine pronoun in these rules shall be interpreted to include the feminine."
I'm inserting it with
Code:
// trim white spaces
$section=trim($_POST['section']);
$content= trim($_POST['content']);
if (!get_magic_quotes_gpc()){
// add slashes to escape text
$section = addslashes($section);
$content = addslashes($content);
}
$query = "insert into hrpolicy values ('', '".$section."', '".$content."')";
Then here is the code to retrieve the data.
Here is what the text looks like in the database now
"In order to avoid the awkward use of “he/sheâ€, “him/herâ€, and “his/her†when referring to employees, the use of the masculine pronoun in these rules shall be interpreted to include the feminine."
Code:
// select from database
$query = "select * from hrpolicy where '".$section."' = '".$section."'";
// here is the line that I retrieve the text with
// I've modified this a dozen times and nothing makes it display correctly
echo nl2br(htmlspecialchars_decode(strip_tags(stripslashes(stripslashes($row['content'])))));
please help, I'm definitely doing something wrong.