Hello, this may be a really simple question or complex im not to sure. I have been working with PHP and MYSQL for a while but im not to say an expert.
I got the front end to work, and for it to post but when it post it doesn't post the formatted text, it only posts the code. For an example say something was in BOLD like this. When displaying the data that is returned, the code which is the b and the /b is shown. Basically i send $postedValue into a MYSQL table. and it works in that sense and then i want to return that information like so:
mysql_connect($ip, $user, $pass) or die(mysql_error()); mysql_select_db("$user") or die(mysql_error()); $query = "SELECT * FROM news"; $result = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_array($result)){ $news = $row['news']; } echo "$news";
Re: Not formatting HTML in PHP (EXTREME DETAIL)
Re: Not formatting HTML in PHP (EXTREME DETAIL)
so i would use this htmlspecialchars says RIGHT before i insert it into the database. then when i recall it will show up as it is suppose to be?
Re: Not formatting HTML in PHP (EXTREME DETAIL)
So now what?
Re: Not formatting HTML in PHP (EXTREME DETAIL)
When somebody else edits HTML, you need to handle the output depending on who's the author and what functionality is being used. For example, in a form post like this one, you want to HTML-encode everything and then process BB-codes to render strings in bold, etc. Some sites accept HTML (as opposed to BB codes), but only allow some tags, like <b> and <i> in the HTML produced by the editor.
Re: Not formatting HTML in PHP (EXTREME DETAIL)
Ok like i said im not an expert. So i am confused, what EXACTLY do i have to do, what do i have to type?
I have checked the database and your right it looks all weird:
Re: Not formatting HTML in PHP (EXTREME DETAIL)
Ive tried only you can help me.
Re: Not formatting HTML in PHP (EXTREME DETAIL)
And now verything works.
Re: Not formatting HTML in PHP (EXTREME DETAIL)