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
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)

Link to comment
Share on other sites

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()

Link to comment
Share on other sites

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
}

Link to comment
Share on other sites

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
}

Link to comment
Share on other sites

$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?

Link to comment
Share on other sites

$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
}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.