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 Link to comment https://forums.phpfreaks.com/topic/61961-solved-2-questions/ 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. Link to comment https://forums.phpfreaks.com/topic/61961-solved-2-questions/#findComment-308556 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 Link to comment https://forums.phpfreaks.com/topic/61961-solved-2-questions/#findComment-308557 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. Link to comment https://forums.phpfreaks.com/topic/61961-solved-2-questions/#findComment-308559 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" : ""); Link to comment https://forums.phpfreaks.com/topic/61961-solved-2-questions/#findComment-308560 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) Link to comment https://forums.phpfreaks.com/topic/61961-solved-2-questions/#findComment-308602 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); Link to comment https://forums.phpfreaks.com/topic/61961-solved-2-questions/#findComment-308606 Share on other sites More sharing options...
jaymc Posted July 27, 2007 Author Share Posted July 27, 2007 Cheers, sprintf worked fine Link to comment https://forums.phpfreaks.com/topic/61961-solved-2-questions/#findComment-308882 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.