Canadiengland Posted March 18, 2007 Share Posted March 18, 2007 so say my url is equip.php?itemid=21 how would i grab the number 21 from the url? something like get itemid='$value' ? Link to comment https://forums.phpfreaks.com/topic/43181-getting-info-from-a-url/ Share on other sites More sharing options...
kenrbnsn Posted March 18, 2007 Share Posted March 18, 2007 Values on the URL are passed to your script via the $_GET superglobal array. In your case you would access it by <?php $itemid = $_GET['itemid']; ?> If you want to see all the values in the $_GET array, do this at the start of your script: <?php echo '<pre>' . print_r($_GET,true) . '</pre>'; ?> Ken Link to comment https://forums.phpfreaks.com/topic/43181-getting-info-from-a-url/#findComment-209681 Share on other sites More sharing options...
chawezul Posted March 18, 2007 Share Posted March 18, 2007 You can also use parse_str() on $_SERVER["QUERY_STRING"] for a register globals effect, getting the query string is generally easy if you're only passing one value to the script, but if you're using it with parse_str it's frowned upon and begs for injection. Link to comment https://forums.phpfreaks.com/topic/43181-getting-info-from-a-url/#findComment-209682 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.