Website help

I am building a website, and I would like some help with one page of my website. The page is a transportation quote page. I have two textboxes. One textbox where the user will input the city of pick up, the other textbox will input the city drop off and a submit button which will give the quote. My problem is with the PHP side where it won’t display my quote. Below is my code for HTML and PHP.

HTML Code

[code]

    quotes for transportation



    City of Pick Up / Airport:
    City of Drop Off / Airport:
     
    [/code]

    and the PHP side which is send_quote.php

    [php]<?php

    $Location1=$POST[‘Location1’];
    $Location2=$POST[‘Location2’];

    if($Location1==“Agnew” xor $Location2==“Agnew”){
    print("$180");
    }
    if($Location1==“Atherton” xor $Location2==“Atherton”){
    print("$125");
    }
    if($Location1==“Bay Meadows” xor $Location2==“Bay Meadows”){
    print("$125");
    }

    ?>[/php]

    Basically as a sample if I input San Francisco in one box, and Agnew in another box it should display the name of both locations and the price $180. Any help is a blessing. Thank you for the time.

you are missing the _ in the _post var

[php]$Location1=$POST[‘Location1’];
$Location2=$POST[‘Location2’];[/php]

[php]$Location1=$_POST[‘Location1’];
$Location2=$_POST[‘Location2’];[/php]

[php]

<?php if(isset($_POST['submit'])){ if (isset($_POST['Location1']) && isset($_POST['Location2'])) { $Location1=$_POST['Location1']; $Location2=$_POST['Location2']; if($Location1=="Agnew" || $Location2=="Agnew"){ print("$180"); }else if($Location1=="Atherton" || $Location2=="Atherton"){ print("$125"); } else if($Location1=="Bay Meadows" || $Location2=="Bay Meadows"){ print("$125"); } } } ?>

    quotes for transportation

    City of Pick Up / Airport:
    City of Drop Off / Airport:
     
    [/php]

You are awesome, and it worked. Now I will just review the code and understand how you went about it. Thank you once again!

My apologies if this is not allowed. If this is not allowed I can make another post. Can you kindly let me know if I am missing anything in the following coding. I have an error

Parse error: syntax error, unexpected ‘{’ in /home/a3290143/public_html/sendquote.php on line 207

[php]if($Location1==“Agnew” || $Location2==“Agnew”){
print(“Town Car = $180 + 15% gratuity

SUV = $205 + 15% gratuity

Stretch Limousine = $230 + 15% gratuity”);
}
} else
if($Location1==“Atherton” && $Location2==“Atherton”){
print(“Town Car = $125 + 15% gratuity

SUV = $150 + 15% gratuity

Stretch = $175 + 15% gratuity”);
}
elseif ($Location1==“Atherton” && $Location2==“SFO”)
{
print(“Town Car = $90 + 15% gratuity

SUV = $150 + 15% gratuity

Stretch = $175 + 15% gratuity”);
}
else ($Location1==“Atherton” && $Location2==“OAK”)
{
print(“Town Car = $131 + 15% gratuity

SUV = $150 + 15% gratuity

Stretch = $175 + 15% gratuity”);
}
} else
if($Location1==“Bay Meadows” || $Location2==“Bay Meadows”){
print(“Town Car = $120 + 15% gratuity

SUV = $145 + 15% gratuity

Stretch = $170 + 15% gratuity”);
}[/php]

I figured it out, thank you! :smiley:

Sponsor our Newsletter | Privacy Policy | Terms of Service