Darkmatter5 Posted October 8, 2008 Share Posted October 8, 2008 I know you can run javascript in href like this: "<a href='javascript:delCabinet($cabinet_id,$cab_name);'>delete</a>", but can you run a php function in the same way? If you can how would the syntax be? Quote Link to comment https://forums.phpfreaks.com/topic/127553-run-php-function-in-href/ Share on other sites More sharing options...
JasonLewis Posted October 8, 2008 Share Posted October 8, 2008 Um, no. JavaScript is client-side, which is why you can run the JavaScript function. PHP is server-side. If you need to run PHP functions you can use JavaScript to call the PHP functions by using Ajax. Google around, I think there are even some tutorials on Ajax on the main PHP Freaks website. Quote Link to comment https://forums.phpfreaks.com/topic/127553-run-php-function-in-href/#findComment-659920 Share on other sites More sharing options...
JonnoTheDev Posted October 8, 2008 Share Posted October 8, 2008 You can run from a tag that includes a src element i.e. an image: <img src="filetorun.php" Quote Link to comment https://forums.phpfreaks.com/topic/127553-run-php-function-in-href/#findComment-659995 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.