AshleyQuick Posted February 22, 2009 Share Posted February 22, 2009 <?php if($_SERVER["PHP_SELF"] == '/products/expitem.php') { ?> <?php ?> Content <?php } ?> The above has always worked fine but I need this to be changed because there are now query strings attached. expitem.php?cmd=exp&id=item01 expitem.php?cmd=exp&id=item02 etc.. --- expitem.php?cmd=exp&id= will remain the same but the string on the end (item...) will be now be dynamic. How can the code above "disregard" what's on the end and display the content? Link to comment https://forums.phpfreaks.com/topic/146302-solved-modifying-an-if-statement-to-include-url-with-various-query-strings/ Share on other sites More sharing options...
Cal Posted February 22, 2009 Share Posted February 22, 2009 Try this... if($_SERVER["SCRIPT_NAME"] == '/products/expitem.php') { It should work even with $_GET variables. Link to comment https://forums.phpfreaks.com/topic/146302-solved-modifying-an-if-statement-to-include-url-with-various-query-strings/#findComment-768092 Share on other sites More sharing options...
AshleyQuick Posted February 22, 2009 Author Share Posted February 22, 2009 SWEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEET, thank you! Link to comment https://forums.phpfreaks.com/topic/146302-solved-modifying-an-if-statement-to-include-url-with-various-query-strings/#findComment-768100 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.