FUNKAM35 Posted August 5, 2008 Share Posted August 5, 2008 I need to add a line of code that states where the price in euros and pounds is 0 it will display as P.O.A. I just cant get anything to work. The price currently displays as Price: 0 € Approximately £0 I need it to display as, ()only if zero rice: P.O.A € Approximately £P.O.A Here is the code I need to insert it into echo"<div id=\"pricediv\">\n"; $display_message=0; if($pound==0) { echo "Price: "; $pound=$price*$euro; $pound=number_format($pound); $price=number_format($price); echo "$price € \n"; echo "<span class =\"approx\">Approximately £$pound\n</span>\n"; $display_message=1; }else{ echo "Price: "; $pound=number_format($pound); echo "£ $pound \n"; } echo"</div>\n"; if($display_message==1)echo"<div id=\"note\"> </div>\n"; echo"</div>\n"; Link to comment https://forums.phpfreaks.com/topic/118265-help-needed/ Share on other sites More sharing options...
lemmin Posted August 5, 2008 Share Posted August 5, 2008 It looks like it is already set up to do that, but it would print the pound amount only if the price is 0. I edited it the way it was. Is this what you were looking for? echo"<div id=\"pricediv\">\n"; $display_message=0; if($pound==0) { echo "Price: P.O.A"; echo "<span class =\"approx\">Approximately P.O.A\n</span>\n"; $display_message=1; }else{ echo "Price: "; $pound=number_format($pound); echo "£ $pound \n"; } echo"</div>\n"; if($display_message==1)echo"<div id=\"note\"> </div>\n"; echo"</div>\n"; Link to comment https://forums.phpfreaks.com/topic/118265-help-needed/#findComment-608707 Share on other sites More sharing options...
FUNKAM35 Posted August 6, 2008 Author Share Posted August 6, 2008 Thank you but this made all prices POA and I only want it to show those with the value 0 as POA, can you help please. Yes, Iwanted this script editing to do that Link to comment https://forums.phpfreaks.com/topic/118265-help-needed/#findComment-609640 Share on other sites More sharing options...
FUNKAM35 Posted August 6, 2008 Author Share Posted August 6, 2008 The way it is set up is to print the pound price only if the euro is 0. I need it to display the POA if both pounds and euros are 0 but if they have value to print them thanks Link to comment https://forums.phpfreaks.com/topic/118265-help-needed/#findComment-609649 Share on other sites More sharing options...
lemmin Posted August 6, 2008 Share Posted August 6, 2008 Oh, I see. $display_message=0; if($pound==0) { echo "Price: "; $pound=$price*$euro; $pound=number_format($pound); $price=number_format($price); echo "$price € \n"; echo "<span class =\"approx\">Approximately £$pound\n</span>\n"; $display_message=1; }elseif (!$pound && !$euro){ echo "Price: P.O.A €\n<span class =\"approx\">Approximately £P.O.A\n</span>\n"; }else{ echo "Price: "; $pound=number_format($pound); echo "£ $pound \n"; } echo"</div>\n"; if($display_message==1)echo"<div id=\"note\"> </div>\n"; echo"</div>\n"; Link to comment https://forums.phpfreaks.com/topic/118265-help-needed/#findComment-609761 Share on other sites More sharing options...
FUNKAM35 Posted August 10, 2008 Author Share Posted August 10, 2008 hI, Thanks, it still doesn't work! Wont display poa, stills howing Price: 0 € Approximately £0 Driving me mad! Link to comment https://forums.phpfreaks.com/topic/118265-help-needed/#findComment-612895 Share on other sites More sharing options...
Bendude14 Posted August 10, 2008 Share Posted August 10, 2008 <?php $display_message=0; $pound = 0; if($pound==0) { echo "Price: P.O.A "; $display_message=1; }else{ echo "Price: "; $pound=number_format($pound); echo "£ $pound \n"; } echo"</div>\n"; if($display_message==1)echo"<div id=\"note\"> </div>\n"; echo"</div>\n"; ?> This works for me Link to comment https://forums.phpfreaks.com/topic/118265-help-needed/#findComment-612932 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.