Wildthrust Posted February 10, 2008 Share Posted February 10, 2008 How do I access a URL variable. All I can seem to find is info on accessing form variables with $_post etc, but can't find like a $_url. do I have to parse the url to get the variable? sorry, confused and just starting to learn php Link to comment https://forums.phpfreaks.com/topic/90378-url/ Share on other sites More sharing options...
AndyB Posted February 10, 2008 Share Posted February 10, 2008 somescript.php?this=6&that=7 ... retrieve the passed variable values from the GET array. Is that what you wanted? Link to comment https://forums.phpfreaks.com/topic/90378-url/#findComment-463362 Share on other sites More sharing options...
Wildthrust Posted February 10, 2008 Author Share Posted February 10, 2008 I think so, basicly I have a directory full of icon files with filenames formated as icon##_##.png. I already have made it so the page will put the list into img tags so I get a page with every icon showing. However the ##_## part is also in a MySql database and I want to click on the icon and send it's ##_## to another page that can then look that up, so I would have a link on each icon like <a href="detail.php?icon=<?php echo substr($filename,4,5); ?>"><img ..... so I would want to be able to build a query on the next page like $sql = "SELECT * FROM TABLE WHERE ICON LIKE \'' . $icon . '\''; where $icon is the the ?icon= Link to comment https://forums.phpfreaks.com/topic/90378-url/#findComment-463365 Share on other sites More sharing options...
Wildthrust Posted February 10, 2008 Author Share Posted February 10, 2008 browsing through the php manual would I do something like $_get['icon'] ? Link to comment https://forums.phpfreaks.com/topic/90378-url/#findComment-463370 Share on other sites More sharing options...
AndyB Posted February 10, 2008 Share Posted February 10, 2008 $_GET['icon'] is what you want Link to comment https://forums.phpfreaks.com/topic/90378-url/#findComment-463375 Share on other sites More sharing options...
Wildthrust Posted February 10, 2008 Author Share Posted February 10, 2008 cool, thanks Link to comment https://forums.phpfreaks.com/topic/90378-url/#findComment-463392 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.