Jump to content

HELP NEEDED


FUNKAM35

Recommended Posts

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

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

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

<?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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.