Polish character condundrum - sending info in text boxes

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
simon_porter00
Forum Newbie
Posts: 13
Joined: Thu Feb 25, 2010 1:25 pm

Polish character condundrum - sending info in text boxes

Post by simon_porter00 »

Hello All,
Apologies if this has been covered - i've looked (honest) and can't find the answer.
I've got a web page where people create adverts etc. They enter their names etc on one page (html, utf-8 encoded without bom) in a text box which then populates a .php page (utf-8 encoded). the php coding hopefully will send the letters correctly to the database which has also been set up utf-8.

The problem is when they are reviewing their information on the php page you see Auml�Auml�Auml�Aring�

The html code is:

Code: Select all

<td>Imię:</td>
<td colspan="2"><input type="text" name="firstname" /></td>
The php code on the information review page is:

Code: Select all

$string1 = isset($_POST['firstname']) ? htmlentities($_POST['firstname']) : false;

if(empty($string1))
{

echo("<h2>Imię:<font color=red>Prozsę wypełnić</font></h2>\n");
$showbutton=1;
}
else
{
$firstname = ereg_replace("[^0-9a-zA-Z?ąćęłńóśżźĄĆĘŁŃÓŚŻŹ ]", "", $string1);
echo("<h2><span class=profile>Imię:</span> <font color=#04B404>" . $firstname . "</font></h2>\n");
echo("<input type=hidden name=firstname value=" . $firstname . ">");
}
Any help on how this can be solved will be gratefully received!
User avatar
McInfo
DevNet Resident
Posts: 1532
Joined: Wed Apr 01, 2009 1:31 pm

Re: Polish character condundrum - sending info in text boxes

Post by McInfo »

Have you defined the character set for the connection, as in mysql_set_charset()?

ereg* functions have been deprecated.
Post Reply