Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 2 of 2 FirstFirst 12
Results 16 to 19 of 19

Thread: Php price

  1. #16
    Regular Coder
    Join Date
    Aug 2013
    Posts
    196
    Thanks
    14
    Thanked 0 Times in 0 Posts

    Code

    <?php
    $ending = strtotime($_POST['endDate']);
    $starting = strtotime($_POST['startDate']);

    $numberDays = floor(abs($ending -$starting) / 86400);

    if ($starting>=$ending){
    echo "Wrong booking " .$_POST['startDate']. " - " .$_POST['endDate']. " Try again to book. ";
    exit();
    }
    echo "You want reserve ".$_POST["rooms"]." room(s) from " .$_POST['startDate']. " until " .$_POST['endDate']. " a period of " .ceil($numberDays). " day(s) and ".ceil($numberDays)." night(s).";
    if($_POST['rooms']=="1"){
    $s1=100;
    }else if ($_POST['rooms']=="2"){
    $s1=200;
    }else if($_POST['rooms']=="3"){
    $s1=300;
    }else if ($_POST['rooms']=="4"){
    $s1=400;
    }
    $price=$numberDays*$s1;
    echo '<br />You must pay me $'.$price;



    if( $vr2 < "0" )
    {
    echo "You didn't enter correct informations " .$_POST['startDate']. " push book now button. ";

    exit();

    }
    if ($p1>=$p2)
    {
    echo "Wrong booking " .$_POST['startDate']. " - " .$_POST['endDate']. " Try
    exit();

    }





    echo "You want reserve rooms in period by " .$_POST['startDate']. " until " .$_POST['endDate']. " in period by " .ceil($numberdays). " days ".ceil($numberdays)." (nights).";

    if($_POST['rooms']=="1")
    {
    $s1=100;


    echo "<br/>";
    //echo $s1. " -21";
    }
    else if ($_POST['rooms']=="2")
    {
    $s1=200;
    echo "<br/>";
    //echo $s1. " -22";
    }
    else if($_POST['rooms']=="3")
    {
    $s1=300;
    echo "<br/>";
    //echo $s1. " -23";
    }
    else if ($_POST['rooms']=="4")
    {
    $s1=400;
    echo "<br/>";
    //echo $s1. " -24";
    }


    echo "<br/>";


    echo "<br/>";
    echo "<br/>";
    $cjena=$umberdays*$s1;
    // echo $cjena;







    $english_format_number = number_format($price);

    echo "You chose room number " .$_POST['rooms']. "(One day staying cost € " .$s1. ").For " .ceil($numberdays). " days final price is € " . ceil($cjena);



    ?>

  2. #17
    Regular Coder
    Join Date
    Aug 2013
    Posts
    196
    Thanks
    14
    Thanked 0 Times in 0 Posts

    Pearl_9

    It is works now but room number 1 cost 100 Euros
    number 2 ,200 Euros.
    number 3 ,300 Euros.
    Number 1 is one bedroom
    Number 2 is two beds
    Number 3 is apartment
    But one more thing ,is it possibly without form to enter $numberdays in datebase.

  3. #18
    Regular Coder
    Join Date
    Aug 2013
    Posts
    196
    Thanks
    14
    Thanked 0 Times in 0 Posts

    Code

    It is working now we fix it,thank you very much.One more thing is possibly to insert $numberdays from code without form in datebase.I have startdate and end date in datebase i wold like to insert into datebase $brojdana.

  4. #19
    Regular Coder
    Join Date
    Aug 2013
    Posts
    196
    Thanks
    14
    Thanked 0 Times in 0 Posts

    Datebase

    It is working code thank you very much,i spent about 15days to fix you did in couple hours.I have one more question is it possibly without form to insert the number in datebase.($numberdays)


 
Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •