Results 1 to 4 of 4

Thread: whats wrong?

  1. #1

    Thread Starter
    Fanatic Member stickman373's Avatar
    Join Date
    Mar 2001
    Location
    MA
    Posts
    909

    whats wrong?

    whats wrong with the below code? it works fine if $dl='pcgame' but none of the other ones work?

    PHP Code:
    <?php
    $dl 
    $_GET[dl]


    if (
    $dl ='pcgame') {
        
    header("Location: /pcgame.php");
    }elseif(
    $dl='movie'){
        
    header("Location: /pcgame.php");
    }elseif(
    $dl='console'){
        
    header("Location: /console.php");    
    }elseif(
    $dl='albums'){
        
    header("Location: /album.php");    
    }elseif(
    $dl='applications'){
        
    header("Location: /application.php");    
    }elseif(
    $dl='ebook'){
        
    header("Location: /ebook.php");        
    }elseif(
    $dl='adult'){
        
    header("Location: /adult.php");        
    }else{        
    echo 
    'not a valid input';
    }
    ?>

  2. #2
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    $dl = $_ENV['dl'];

    _b

  3. #3
    Frenzied Member
    Join Date
    Nov 1999
    Posts
    1,337
    uhh you need 2 = in there
    also if you are getting them from the url you will need $_GET['dl'] instead. not $_ENV
    PHP Code:
    if ($dl =='pcgame') {
        
    header("Location: /pcgame.php");
    }elseif(
    $dl=='movie'){
        
    header("Location: /pcgame.php");
    }elseif(
    $dl=='console'){
        
    header("Location: /console.php");    
    }elseif(
    $dl=='albums'){
        
    header("Location: /album.php");    
    }elseif(
    $dl=='applications'){
        
    header("Location: /application.php");    
    }elseif(
    $dl=='ebook'){
        
    header("Location: /ebook.php");        
    }elseif(
    $dl=='adult'){
        
    header("Location: /adult.php");        
    }else{        
    echo 
    'not a valid input';


  4. #4
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    Just adding to what phpman said...

    Code:
    $num = 2;
    Is used to assign a variable. So if you have:

    Code:
     if ($num = 2) {
    You are assigning 2 to the variable, which will then return true (or success) and execute that IF statement.

    Code:
    if ($num == 2) {
    Is the boolean test statement to find out what something equals.
    My evil laugh has a squeak in it.

    kristopherwilson.com

Posting Permissions

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



Click Here to Expand Forum to Full Width