SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    Pragmatic Programmer halfasleeps's Avatar
    Join Date
    Feb 2006
    Location
    Altoona, PA. USA
    Posts
    1,945
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    whats wrong with this conditional?

    if($_GET['State']){
    $state = $_GET['State'];
    }else{
    $state = $_POST['State'];
    }

    if($state == 'PA') {
    $Tax = .06; // 6.00%
    } else {
    $Tax = 0;
    }

    when it recieves the State=PA as a POST it works but when it reiceves the State=PA as a GET it displays the tax as 0.00 but i dont unserstand bc i can look right in the url and see that the GET IS there something.php?State=PA so im clueless why its coming up as zero when sent as a GET
    Altoona Design
    Freelance Flex developer for hire.
    ActionScript Programmer with 8 Years Experience.

  2. #2
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Try

    PHP Code:
    if (isset($_GET['State'])) { 
    echo'ing your variable is also good for debugging.

  3. #3
    Pragmatic Programmer halfasleeps's Avatar
    Join Date
    Feb 2006
    Location
    Altoona, PA. USA
    Posts
    1,945
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Dan Grossman
    Try

    PHP Code:
    if (isset($_GET['State'])) { 
    echo'ing your variable is also good for debugging.
    thank you for you reply i had the wrong url in the link lol...so yes the GET was set but it was going to an older version of the page where it didnt check for it. It works now.
    Altoona Design
    Freelance Flex developer for hire.
    ActionScript Programmer with 8 Years Experience.

  4. #4
    Obey the Purebreed trib4lmaniac's Avatar
    Join Date
    Dec 2004
    Location
    Cornwall, UK
    Posts
    594
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    $_REQUEST["state"


Bookmarks

Posting Permissions

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