Forum Moderators: coopster
I use str_replace to convert the pound sign into
£ but I can't seem to use a str_replace to get rid of this foreign A or find our why safari adds it. Any ideas?
Is the data coming from an array? It may be that the array was not initialised before it was used. Hence the inclusion of the strange character. I`m not sure why this happens, but I had a similar problem earlier this year.
If it is an array, make sure you initialise it first. ie:
$variable = array();
dc
the form:
<form id="add_job" method="post" action="/recruitment/admin/functions/jobs.php">
...
<label for="wage">Wage *</label><input type="text" id="wage" name="wage" tabindex="4" />
...
</form>
the PHP/SQL
//convert £s into escaped £ signs
$_POST['wage'] = str_replace('£', '£', $_POST['wage']);
I've established that the strange character is added after the last str_replace code snippet.
$variable = str_replace('£', '£', $_POST['wage']);
Then add to the database using the new variable. Or assign the data like this:
$variable = $_POST['wage'];
Then do the string replace upon database insertion:
INSERT INTO table (field) VALUES ('".str_replace("£", "£", $variable)."');
See if that helps.
dc