Input special characters

General discussions related to php

Moderators: macek, egami, gesf

Jaclin
New php-forum User
New php-forum User
Posts: 2
Joined: Sun May 12, 2013 12:02 am

Input special characters

Postby Jaclin » Sun May 12, 2013 12:08 am

Hello,

I want to draw data from a form to my MySQL database: $kenmerken = $_POST['kenmerken']); Then if there are special characters in the text (like ", ', á enz.) I lose them. I tried htmlspecialchars and strip_tags but I still cannot use chars like á.
Is there a solution for this problem?

:help: Jac

swarups
New php-forum User
New php-forum User
Posts: 20
Joined: Tue Mar 06, 2012 11:05 pm

Re: Input special characters

Postby swarups » Sun May 12, 2013 10:38 pm

Hi,

Before querying the database, set the character set to utf-8 by the code

Code: Select all

$db_con->query("SET CHARACTER SET 'utf8'");
.

Not sure, but guess this will sove your problem.

Thanks
Swarup Sahu
http://www.mindfiresolutions.com/

Jaclin
New php-forum User
New php-forum User
Posts: 2
Joined: Sun May 12, 2013 12:02 am

Re: Input special characters

Postby Jaclin » Tue May 14, 2013 1:37 am

Thank you, but doesn't work.
Jac


Return to “PHP General”

Who is online

Users browsing this forum: No registered users and 2 guests