diacritics - Accents does not appear with php -
i have form post comments when comment words have accents, accents not appear. have :
> bla èèèèème
i have on header : <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
so it's problem php not know add in form
my form : <?php print_comments();?> <h3> add comments </h3> <form action="article1.php" method="post" > <span class="input-label">name</span> <input type="text" required name="comment_name" <br/> <br/> <span class="input-label">email</span> <input type="text" required name="comment_email" <br/> <br/> <textarea class="input-label" name="comment" required rows="5" cols="30"></textarea> <br/> <br/> <input type="hidden" name="article_id" value="<?php echo $article['_id'];?>" /> <input type="submit" name="btn_submit" value="save"/> </form> </body> </html>
everything appears correctly except comments
probably while saving post in db, encoding entities make ampersand (&) & , therefore nullifies remaining characters being part of entity.
you can fix performing html_entity_decode() on output string before printing page.
e.g
<?php echo html_entity_decode($comments); ?>
Comments
Post a Comment