i have a small confusion here . in my project i need to display prices for rooms as per dates . for example . from 01 oct 2017 to 31st oct 2017 price is $200. from 01st nov to 30th nov price is $250 and so on .....
now i am trying to do it this way ....
<?php
$currnt_time = time();
$from_date = strtotime(2017-10-01);
$till_date = strtotime(2017-10-31);
if ($currnt_time >= $from_date && $currnt_time < $till_date){
$price = $200;
}
?>
<P> Starts FROM <?php echo $price; ?> INR</P>
but when i run this script it says undefined variable $price . i cant understand where i am wrong ) and as i will be having many dates slots like above so what will be the best way to solve this . Please help. Thanks !
You have a $
in front of the value for $price
, and you've fogetten to add the quote before and after date strings.
<?php
$currnt_time = time();
$from_date = strtotime('2017-10-01');
$till_date = strtotime('2017-10-31');
if ($currnt_time >= $from_date && $currnt_time < $till_date){
$price = 200;
}
?>
<P> Starts FROM <?php echo $price; ?> INR</P>
?>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.