jaymc Posted July 27, 2007 Share Posted July 27, 2007 Question 1 When outputting information to a textarea, the pount sign (£) is being displayed as a square Ive tried changing the page charset to one supposed to resolve this but it hasnt work I understand its due to the forum enctype Im only using the textarea to display info, im not submitting it anywhere Question 2 I want to turn this (4.6) into (4.60) Basically, money format that tells you the exact pence with a leading zero if required Quote Link to comment Share on other sites More sharing options...
Foser Posted July 27, 2007 Share Posted July 27, 2007 I'm guessing for question to. <?php $convert = 0.00; $money = $_POST['money']; conversion_output = $convert + $money; ?> I think this would work but I'm not positive. Quote Link to comment Share on other sites More sharing options...
jaymc Posted July 27, 2007 Author Share Posted July 27, 2007 I'm guessing for question to. <?php $convert = 0.00; $money = $_POST['money']; conversion_output = $convert + $money; ?> I think this would work but I'm not positive. Didnt work Quote Link to comment Share on other sites More sharing options...
tibberous Posted July 27, 2007 Share Posted July 27, 2007 Whats the code for the £ that isn't working, because it works fine for me, even with the form enctype set. Are you sure your not using a weird font? You could try adding style="font-family: verdana" to the textarea and see if that fixes it. Quote Link to comment Share on other sites More sharing options...
tibberous Posted July 27, 2007 Share Posted July 27, 2007 For the second part, try this: $money = explode(".", $money); $money[1] = substr($money[1], 0, 2); $money = $money[0] . "." . (strlen($money[1]) < 1 ? "0" : "") . (strlen($money[1]) < 2 ? "0" : ""); Quote Link to comment Share on other sites More sharing options...
hvle Posted July 27, 2007 Share Posted July 27, 2007 About the pound sign, try to encode your html as unicode, it will work. the money format, you can use classic sprintf $formatedMoney = sprintf("%.2f", $money); The %.2f tell php to output a float (f) and have a 2 decimal digit (2) Quote Link to comment Share on other sites More sharing options...
jitesh Posted July 27, 2007 Share Posted July 27, 2007 A1 <textarea name="teeee">£This is pound sign</textarea> A2 $val = 4.6; printf("%.2f",$val); Quote Link to comment Share on other sites More sharing options...
jaymc Posted July 27, 2007 Author Share Posted July 27, 2007 Cheers, sprintf worked fine Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.