How to do this URL stuff..?

Sorry my title was not very descriptive, Its just, Im not sure what to call these or even, how to do it…

Alright, first thing of two, I have seen URLs like these:

index.php
index.php?id=index
index.php?index
index.php?/index/

Now, I know how using forms to GET the data entered is possible, but ive looked into this and havent found a single form code around the URLs. Ive also looked at various resources, and haven’t found out how to do this without form codes.

Second thing, ive seen how those urls can display different outcomes, but also effect what the page displays this, so when making an install script and other things for my script, I would like to know how I can make stuff like these URLs:

install.php?/step-1
install.php?/step-2
or
install.php?step-1
install.php?step-2

and also create URLs like this for my user register and user login URLs:

index.php?/register
index.php?/login
index.php?register
index.php?login
index.php?i=register
index.php?i=login

And for more info, I use a folder called library to store all my extra files, and I would like one of those to and ‘i’ is for a simple looks in case it requires one. If it requires .htaccess edits, I can do that to. :slight_smile:

Thanks for any help guys!
-Improvizionz

I’m not really sure what it is you’re asking… but this is my response based on the guess that you’re asking what the different types of URLs do…
The first one [php]index.php[/php] just points to the file index.php and opens it…
The second one passes an variable id which has a value of index INTO the index.php page… You can retrieve it using either the GET or REQUEST command like so:

$id = $_REQUEST['id'];
or 
$id = $_GET['id'];

When you print $id it gives:

print $id;

output:
index

The third one is similar, but this time it passes a variable called ‘index’ into the index.php file. But since you havent assigned any value, it will be null… You can retrieve it, just like the previous one… If you want to give a value (val) to the variable, just make it

index.php?index=val

I’m not sure of the last one… I havent really seen it…

With this, I’m sure you know how to those urls u mentioned in the end…

Hope I’ve answered your question…
Cheers
Ramana

I guess that partially answered, but I want to know how I can set up different points in my script so I can make my urls like that, but I dont know how to…

So more or less I am for a little tutorial or example of how I can do this…

And on the last one it is common with Invision Power Board Forums after you change the default application from inside the init-data.php. I have seen it in other various places, but I really want to know how I can make stuff like these URL for various different pages while I have PHP Pages inside a sub-directory called “library”.

I really just want to clean it up, so if anyone can tell me how to make it so I can change my URLs to one of those inside my pages. I would be so thankful!

Thanks though for a little help.

-Improvizionz

Not sure I understand what your after either but expanding on RamanaKumar’s post you would deal with your URL’s like so.

If you have a link like www.index.php?id=two
You will do something like this in your script:
[php]
if(isset($_POST[‘id’])) {
$var = $_POST[‘id’];
[/php]
Now you have a variable with the value from the URL assigned, in this case “two”.
Then all you do is create a conditional statement, something like this:
[php]
if($var == “two”) {
//your code to be executed here
}
[/php]
So create a conditional loop that will test the value of $var and display what you want depending on its value.

Okay, I had to combine your guys codes, finally I get this, thank you guys SO MUCH!

You guys are amazing, thanks for all the help!

-Improvizionz

Sponsor our Newsletter | Privacy Policy | Terms of Service