Jump to content

$_get function transfering


quelle

Recommended Posts

if i got some homepage named index.php and got a $_GET function which calls index.php?strana=2, how do i define so my index.php or just www.example.com/folder/ is same like index.php?strana. Cuz Ive got 2 forms on my website and when i put index.php?strana - i get the first one, when i put index.php?strana=2 - i get the second one but when i put index.php only or blank as i said above im still getting second form

Link to comment
https://forums.phpfreaks.com/topic/222428-_get-function-transfering/
Share on other sites

Obviously u didnt get what i mean, that variable will give FALSE because i use just for ex. localhost/fuckme/index.php so it would still show my second form ... I want some code that will check for me do i use index.php or index.php?strana=(no matther what number)

if u r working on to pass variables from pages to pages, u got to always use the suffix ? at the end just after .php no matter the directory ur file is placed in. For instance, /home/strana/index.php?strana= like this. When $_GET is not set n u want to execute another function, use !isset()

ive got something like this

if (isset($_GET['strana']) &&  $_GET['strana'] == ""){
//and here comes the form code 1
...
}
//then i got else, form code 2. Since i wanna show only 2 forms i can just use if, else
else{
...
}

 

Try This: )

$strana = $_GET['strana'];

if(isset($strana){
    if ($strana == "2"){
        //My code for ?strana=2
    }
    else{
       //My code for ?strana
    }
}
else{
    //My code when strana is not set
}

Also, assuming in the future you had more values for strana

 

you could use:

$strana = $_GET['strana'];

if(isset($strana){
    if ($strana == "2"){
        //My code for ?strana=2
    }
    elseif($strana == "3"){
        //My code for ?strana=3
    }
    else{
       //My code for ?strana
    }
}
else{
    //My code when strana is not set
}

$strana = $_GET['strana'];

if(isset($strana){
    if ($strana == "2"){
        //My code for ?strana=2
    }
    elseif($strana == "3"){
        //My code for ?strana=3
    }
    else{
       //My code for ?strana
    }
}
else{
    //My code when strana is not set
}

 

how would i define here that index.php is same as index.php?strana?

$strana = $_GET['strana'];

if(isset($strana){
    if ($strana == "2"){
        //My code for ?strana=2
    }
    elseif($strana == "3"){
        //My code for ?strana=3
    }
    else{
       //My code for ?strana
    }
}
else{
    //My code when strana is not set
}

 

how would i define here that index.php is same as index.php?strana?

 

 

Like this:

$strana = $_GET['strana'];

if(isset($strana){
    if ($strana == "2"){
        //index.php?strana=2
    }
    elseif($strana == "3"){
        //index.php?strana=3
    }
    else{
       //index.php
    }
}
else{
    //index.php
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.