Hi
I'm stuck on some code which I've read should work, but it isn't
This is what I'm trying to do:
I've called a field $turnover from a database and put the value in an input box:
it goes something like this:
$result = mysql_query ("SELECT id, currency,turnover from db where id="1"")
if ($myrow = @mysql_fetch_array($result))
{
$currency=$myrow["currency"];
$turnover=$myrow["turnover"];
$turnover=$currency.$turnover;
echo"<FORM NAME='Money' ACTION='updates.php' METHOD='POST'>\n";
echo "<INPUT TYPE=text NAME='turnover' VALUE='$turnover' SIZE=40 MAXLENGTH=100>";
echo " submit and so on..."
}
I basically display the value of $turnover in the input field, with $currency appended to it. So if the value of $currency = "$" and $turnover is "500" the value of the input field would be "$500"
This bit works. The problem is when the user then changes the currency to be "£" the "$" symbol is added to the $turnover field in the db even though before I submit the data I have put:
$turnover = ereg_replace("£","",$turnover);
$turnover = ereg_replace("€","",$turnover);
$turnover = ereg_replace("\$","",$turnover);
For some reason it does not excape the $ symbol, but it works perfectly well with the £ or € symbol
Can anyone help??:queasy: