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? 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. 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" 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
Archived
This topic is now archived and is closed to further replies.