digitalgod Posted November 1, 2006 Share Posted November 1, 2006 just wondering how could I use $_GET to get whatever value that's after the ?so something like index.php?digitalgod I need to get the digitalgod part Quote Link to comment Share on other sites More sharing options...
Orio Posted November 1, 2006 Share Posted November 1, 2006 You should look into "mod rewrite". You can find information and links in [url=http://en.wikipedia.org/wiki/Mod_rewrite]Wikipedia[/url] :)Orio. Quote Link to comment Share on other sites More sharing options...
.josh Posted November 1, 2006 Share Posted November 1, 2006 if you have index.php?digitalgod=blahin your script you would use$_GET['digitalgod']example:echo $_GET['digitalgod']; // output: blah Quote Link to comment Share on other sites More sharing options...
alpine Posted November 1, 2006 Share Posted November 1, 2006 Or this might be what u are looking for:[code]<?php// index.php?digitalgodecho parse_url($_SERVER['REQUEST_URI'], PHP_URL_QUERY); // digitalgod?>[/code] Quote Link to comment Share on other sites More sharing options...
digitalgod Posted November 1, 2006 Author Share Posted November 1, 2006 thanks [b]Orio[/b], I'll take a look at that, quick question though, I only want the members section to work like that, if I use mod_rewrite do I have to change the entire script or just the part that I need?[b]Crayon Violent[/b], I already know how to do that, I just need the digitalgod part, I want to be able to display a user's profile that way. So someone can go to members.php?crayonviolent and see your profile.[b]Alpine [/b] what would be the difference between that and using mod_rewrite? I haven't read up on mod_rewrite yet so I don't know much about it Quote Link to comment Share on other sites More sharing options...
alpine Posted November 1, 2006 Share Posted November 1, 2006 mod_rewrite is the real thing, my example is faking it ...... Quote Link to comment Share on other sites More sharing options...
digitalgod Posted November 1, 2006 Author Share Posted November 1, 2006 I read a little and noticed that I would have to go and change all of the links in my script... which would be way too much work and almost impossible at this point Quote Link to comment Share on other sites More sharing options...
digitalgod Posted November 1, 2006 Author Share Posted November 1, 2006 Alpine I'm getting this error with your lineWarning: parse_url() expects exactly 1 parameter, 2 given test.php on line 2 Quote Link to comment Share on other sites More sharing options...
alpine Posted November 1, 2006 Share Posted November 1, 2006 Works with me,[quote]mixed parse_url ( string url [, int component] )[/quote]Study the manual on how it works:http://no.php.net/manual/en/function.parse-url.php*EDIT: The manual says PHP 3,4,5 but only PHP5.1.2 up with the "int component" addedExample for PHP4 found here: http://no2.php.net/manual/en/function.parse-url.php#70690 Quote Link to comment Share on other sites More sharing options...
digitalgod Posted November 10, 2006 Author Share Posted November 10, 2006 thanks alpine, it works perfectly now. I knew it had something to do with the php version. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.