max_w1 Posted August 20, 2011 Share Posted August 20, 2011 here is what i am trying to do. i have a url in my browser like this: http://localhost/jmla/index.php?option=com_content&view=article&id=1295:sovereign-a-country-risk-workshop as usuall we get elements form the url using the $_GET method, but here when i try to get id from the above url. i can get 1295:sovereign-a-country-risk-workshop. whereas the id is only 1295 and the other part is alias which i want to get seperately. is there a way to do so? Link to comment https://forums.phpfreaks.com/topic/245304-get-method/ Share on other sites More sharing options...
KevinM1 Posted August 20, 2011 Share Posted August 20, 2011 $idInfo = $_GET['id']; list($idNumber, $idText) = explode(':', $idInfo); echo $idNumber; Link to comment https://forums.phpfreaks.com/topic/245304-get-method/#findComment-1259911 Share on other sites More sharing options...
voip03 Posted August 20, 2011 Share Posted August 20, 2011 If you want to get seperately can you use id=1295&d=sovereign-a-country-risk-workshop. Link to comment https://forums.phpfreaks.com/topic/245304-get-method/#findComment-1259912 Share on other sites More sharing options...
OneShot Posted August 20, 2011 Share Posted August 20, 2011 to add to Nightslyr's reply ............. list($idNumber, $idText) = explode(':', (htmlspecialchars($_GET['id']))); echo $idNumber; or you could do as voip03 suggested and just ignore d if you have no reason to call it..... Link to comment https://forums.phpfreaks.com/topic/245304-get-method/#findComment-1259927 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.