Deivas Posted March 13, 2010 Share Posted March 13, 2010 Is there an easier way to make hyperlinks with $_GET because when I make a hyperlink I need to do if statements to see if the site is using it. Link to comment https://forums.phpfreaks.com/topic/195127-_get/ Share on other sites More sharing options...
arbitter Posted March 13, 2010 Share Posted March 13, 2010 Could you explain you problem a little more? What are you trying to do? there's $_GET[] to get a variable from the url and there's $_POST[] to get something from a form the page before Link to comment https://forums.phpfreaks.com/topic/195127-_get/#findComment-1025653 Share on other sites More sharing options...
Deivas Posted March 13, 2010 Author Share Posted March 13, 2010 Could you explain you problem a little more? What are you trying to do? there's $_GET[] to get a variable from the url and there's $_POST[] to get something from a form the page before I have a lot of links in my website, and on most of them I need to do this (this might be wrong) : if($_GET['type'] != null){ if($_GET['order'] == null){ $nav .= " <a href=\"$self?page=$page&&type=$type\">$page</a> "; } if($_GET['order'] != null){ $nav .= " <a href=\"$self?page=$page&&type=$type&&order=$order\">$page</a> "; } } if($_GET['type'] == null){ $nav .= " <a href=\"$self?page=$page\">$page</a> "; } and etc , I am asking if it is possible to do it faster? Link to comment https://forums.phpfreaks.com/topic/195127-_get/#findComment-1025654 Share on other sites More sharing options...
wildteen88 Posted March 13, 2010 Share Posted March 13, 2010 Build you're url as you check to see if the $_GET['type'] and $_GET['order'] exists. Eg: $url = "<a href=\"$self?page=$page"; if(isset($_GET['type']) && !empty($_GET['type'])) $url .= "&type=$type"; if(isset($_GET['order']) && !empty($_GET['order'])) $url .= "&order=$order"; $url .= "\">$page</a>"; echo $url; Link to comment https://forums.phpfreaks.com/topic/195127-_get/#findComment-1025726 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.