Stunt Posted April 22, 2007 Share Posted April 22, 2007 I was wondering how to do this. Say I have an URL: http://siteexample.com/?ab1=Artwork Then for another link I would have: http://siteexample.com/?ab2=Artwork How would I do that? Thanks. Link to comment https://forums.phpfreaks.com/topic/48084-php-extension/ Share on other sites More sharing options...
V34 Posted April 22, 2007 Share Posted April 22, 2007 http://siteexample.com/?ab1=Artwork&ab2=Artwork You just need a $_GET['ab1'] and a $_GET['ab2'] And if you wan't to add more you keep using the "&". http://siteexample.com/?ab1=Artwork&ab2=Artwork&ab3=Artwork&ab4=Artwork Link to comment https://forums.phpfreaks.com/topic/48084-php-extension/#findComment-234992 Share on other sites More sharing options...
Stunt Posted April 22, 2007 Author Share Posted April 22, 2007 But see, I'm kind of new to this. I have a file called dw3story.php in my root, now how would I make the link in the nav bar: http://domain.com?dw3=story Link to comment https://forums.phpfreaks.com/topic/48084-php-extension/#findComment-234996 Share on other sites More sharing options...
V34 Posted April 22, 2007 Share Posted April 22, 2007 <?php if ($_GET['dw3'] == "story") { $site = "dw3story.php";} elseif ($_GET['dw3'] == "artwork") {$site = "dw3artwork.php";} include("$site"); ?> I guess this actually isn't what wanted. But of what I know there's no automatic way to find what variable that are used, with what value in. So I guess you need to make 2 $_GET[]'s like: http://siteexample.com/?dw=3&page=Artwork Link to comment https://forums.phpfreaks.com/topic/48084-php-extension/#findComment-235120 Share on other sites More sharing options...
tarun Posted April 22, 2007 Share Posted April 22, 2007 Wrong Forum But I Have A JavaScript Method Aswell <script type="text/javascript"> function getValue(varname) { var url = window.location.href; var qparts = url.split("?"); if (qparts.length == 0) { return ""; } var query = qparts[1]; var vars = query.split("&"); var value = ""; for (i=0;i<vars.length;i++) { var parts = vars[i].split("="); if (parts[0] == varname) { value = parts[1]; break; } } value = unescape(value); value.replace(/\+/g," "); return value; } </script> <script type="text/javascript"> var dw3 = getValue("dw3"); if(dw3 == "story"){ document.write('Content Here') } if(dw3 == "artwork"){ document.write('Content Here') } else document.write('Error') </script> Link to comment https://forums.phpfreaks.com/topic/48084-php-extension/#findComment-235196 Share on other sites More sharing options...
Stunt Posted April 22, 2007 Author Share Posted April 22, 2007 Do I put that code in the dw3story.php ? If you want a live example of what I'm trying to do, check here: http://kh2.co.uk/?kh2=Information Link to comment https://forums.phpfreaks.com/topic/48084-php-extension/#findComment-235248 Share on other sites More sharing options...
Stunt Posted April 28, 2007 Author Share Posted April 28, 2007 Bump. Link to comment https://forums.phpfreaks.com/topic/48084-php-extension/#findComment-240604 Share on other sites More sharing options...
Stunt Posted April 30, 2007 Author Share Posted April 30, 2007 Once again, BUMP. Link to comment https://forums.phpfreaks.com/topic/48084-php-extension/#findComment-241287 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.