flit Posted April 9, 2008 Share Posted April 9, 2008 Hi there, Can anyone help me with the code to execute a php code when a html link is clicked? Quote Link to comment https://forums.phpfreaks.com/topic/100277-how-do-i-execute-a-php-code-when-a-html-link-is-clicked/ Share on other sites More sharing options...
awpti Posted April 9, 2008 Share Posted April 9, 2008 Create a script that said link points to. It's not magic. But it is server-side. Quote Link to comment https://forums.phpfreaks.com/topic/100277-how-do-i-execute-a-php-code-when-a-html-link-is-clicked/#findComment-512717 Share on other sites More sharing options...
flit Posted April 9, 2008 Author Share Posted April 9, 2008 awpti I don't understand you, can you show me with an example? Quote Link to comment https://forums.phpfreaks.com/topic/100277-how-do-i-execute-a-php-code-when-a-html-link-is-clicked/#findComment-512720 Share on other sites More sharing options...
awpti Posted April 9, 2008 Share Posted April 9, 2008 http://www.php.net/docs.php There you go. Read up. No one is going to do it for you (at least, I hope not - unless they are getting paid). PHP is easy to learn. Quote Link to comment https://forums.phpfreaks.com/topic/100277-how-do-i-execute-a-php-code-when-a-html-link-is-clicked/#findComment-512722 Share on other sites More sharing options...
flit Posted April 9, 2008 Author Share Posted April 9, 2008 Nice attitude Quote Link to comment https://forums.phpfreaks.com/topic/100277-how-do-i-execute-a-php-code-when-a-html-link-is-clicked/#findComment-512724 Share on other sites More sharing options...
ansarka Posted April 9, 2008 Share Posted April 9, 2008 ??? ??? ??? what i understand from your question is you want your url to be in .html and internally you want to call a php page is it? if my understaing is correct you hv to use the .htacces file to define some rules to call a php page internally when you execute a html page please go through the url rewrite using .htaccess in php (at least, I hope not - unless they are getting paid). i dont think this attitude is good when you are in a php or any other open source supported programmer Quote Link to comment https://forums.phpfreaks.com/topic/100277-how-do-i-execute-a-php-code-when-a-html-link-is-clicked/#findComment-512726 Share on other sites More sharing options...
flit Posted April 9, 2008 Author Share Posted April 9, 2008 Sorry for my bad english, but what I really mean is something like this: <a href="1.php"<?php ...........?>Link</a> something like that, I know that the code above is not possible but something like that when I click the link I want some code to be executed. I am trying to delete a session id when I click on a link. Quote Link to comment https://forums.phpfreaks.com/topic/100277-how-do-i-execute-a-php-code-when-a-html-link-is-clicked/#findComment-512729 Share on other sites More sharing options...
zenag Posted April 9, 2008 Share Posted April 9, 2008 yeah its possible.... pass session id in the link as <a href="...php?id=<? ?>like that.. and use that id to write delete query... Quote Link to comment https://forums.phpfreaks.com/topic/100277-how-do-i-execute-a-php-code-when-a-html-link-is-clicked/#findComment-512731 Share on other sites More sharing options...
ansarka Posted April 9, 2008 Share Posted April 9, 2008 when you click the link go to a page where you can write code to delete the section form this page redirect to actual page you want to go that is in btween one page come but user dosent really notice that eg you are in my.php from here you click logout.php when you click logout.php you should delete the section and take the user to a thankyou.html so in logout link take the user to logout.php write a code to delete session . in logout.php wiret the code header("Location: thankyou.html") this will take the user to thankyou.html Quote Link to comment https://forums.phpfreaks.com/topic/100277-how-do-i-execute-a-php-code-when-a-html-link-is-clicked/#findComment-512733 Share on other sites More sharing options...
flit Posted April 9, 2008 Author Share Posted April 9, 2008 ThanksIs it possible to beat up GOD? Quote Link to comment https://forums.phpfreaks.com/topic/100277-how-do-i-execute-a-php-code-when-a-html-link-is-clicked/#findComment-512741 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.