tmh766 Posted February 11, 2007 Share Posted February 11, 2007 Hi can I have a quick example on how to pass a php argument through and html link and how the php document that accepted the passed variable would be setup? phpdoc1.php a href="phpdoc2.php?passedVar=3455" phpdoc2.php <?php echo($passedVar); ?> is not working.. Link to comment https://forums.phpfreaks.com/topic/37995-solved-passing-php-arguments-through-html-link/ Share on other sites More sharing options...
redarrow Posted February 11, 2007 Share Posted February 11, 2007 a.php we set a condition to the url in this example we set got=it if the got=it is in the url you get a nice message ok. <?php //get this file echo"<a href='b.php?got=it'>get the file</a>"; ?> b.php <?php if($_GET['got']=="it"){ echo "Hi there mate hows you"; }else{ echo "sorry you have not come from the correct url"; } ?> Link to comment https://forums.phpfreaks.com/topic/37995-solved-passing-php-arguments-through-html-link/#findComment-181833 Share on other sites More sharing options...
redarrow Posted February 11, 2007 Share Posted February 11, 2007 a href="phpdoc2.php?passedVar=3455" All you need is this test.php <?php $test=$_GET['passedVar']; echo $test; ?> but like the above post always have a set condition in the url for safe reason's Link to comment https://forums.phpfreaks.com/topic/37995-solved-passing-php-arguments-through-html-link/#findComment-181834 Share on other sites More sharing options...
tmh766 Posted February 11, 2007 Author Share Posted February 11, 2007 Thank you so much! Link to comment https://forums.phpfreaks.com/topic/37995-solved-passing-php-arguments-through-html-link/#findComment-181835 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.