TheAlbinoEthiopian

msg:3658804 | 9:50 pm on May 25, 2008 (gmt 0) |
I don't think you can use colons in urls outside of the http:// part, firefox filters it out of the href. Anyway, why don't you just use another variable? Like ?do=home&sub=1?
|
PokeTech

msg:3658806 | 9:54 pm on May 25, 2008 (gmt 0) |
how do you do that? EDIT: examples greatly appreciated [edited by: PokeTech at 9:55 pm (utc) on May 25, 2008]
|
yumigator

msg:3658818 | 10:33 pm on May 25, 2008 (gmt 0) |
If you had the url given as index.php?do=home&sub=1 you could use the variables $_GET['home'] and $_GET['sub'] in your script. <?php function viewdoSection($do) { switch ($do) { case 'home': $section = 'home'; break; default: $section = FALSE; break; } return $section; } if (isset($_GET['do']) && !empty($_GET['do'])) { viewdoSection($_GET['do']); if ($section == 'home') { if (isset($_GET['sub']) && !empty($_GET['sub'])) { switch ($_GET['sub']) { // handle $_GET['sub'] however you wish } } else { echo('some error message'); } } else { echo('some error message'); } } ?> I didn't see anything in your code that would handle the other part of the URL, but this should give you a general idea. If you absolutely need the type of URL your originally asked about, a comma instead of a colon would work very well. I personally prefer slashes for the search-engine-friendliness.
|
PokeTech

msg:3658831 | 10:57 pm on May 25, 2008 (gmt 0) |
For some reason I keep getting the "some error message" why is that? I really don't know much about $_GET so thats why I'm asking.
|
yumigator

msg:3658842 | 11:41 pm on May 25, 2008 (gmt 0) |
A stupid mistake on my part. Change "viewdoSection($_GET['do']);" to "$section = viewdoSection($_GET['do']);" If everything works correctly, you should see a blank page (since there is no logic processing $_GET['sub']: all that is there is a comment. Anyway, that was just an example; it probably won't help you much in the way of getting some working code. $_GET is quite simple. If you give the URL as index.php?foo=bar the variable $_GET['foo'] will be set to "bar" in your script. For multiple values: index.php?foo=bar&yes=no would set $_GET['foo'] to "bar" and $_GET['yes'] to "no". You can use a $_GET variable as you would any other variable. Knowing that, you should be able to apply your knowledge of control structures to getting exactly the effect you want.
|
jianliangwang

msg:3663586 | 11:59 am on May 31, 2008 (gmt 0) |
$do = $_GET['do']; $do =explode(":",$do); $do = $do[1];
|
|