leaboy12 Posted June 24, 2009 Share Posted June 24, 2009 I have a php page (lib.php) that contains a function (function downloadToCSV()) that will grab data from the database a place it into a CSV file. On the same php page (lib.php) i have i <div> tag where i want to call that function (function downloadToCSV()). What is the correct syntax in the <div> tag to call that function?? Quote Link to comment https://forums.phpfreaks.com/topic/163459-calling-php-function-from-tag/ Share on other sites More sharing options...
RichardRotterdam Posted June 24, 2009 Share Posted June 24, 2009 I don't see how a div tag is related to a php function What exactly do you mean ???. Do you know the difference between clientside and serverside? Quote Link to comment https://forums.phpfreaks.com/topic/163459-calling-php-function-from-tag/#findComment-862500 Share on other sites More sharing options...
leaboy12 Posted June 24, 2009 Author Share Posted June 24, 2009 I do know the difference PHP is sever side and HTML is client side. Quote Link to comment https://forums.phpfreaks.com/topic/163459-calling-php-function-from-tag/#findComment-862506 Share on other sites More sharing options...
n1tr0b Posted June 24, 2009 Share Posted June 24, 2009 oh you can do this echo "<div>blabla</div>"; // or echo '<div>blabla</div>"; Quote Link to comment https://forums.phpfreaks.com/topic/163459-calling-php-function-from-tag/#findComment-862521 Share on other sites More sharing options...
wildteen88 Posted June 24, 2009 Share Posted June 24, 2009 oh you can do this echo "<div>blabla</div>"; // or echo '<div>blabla</div>"; Thats code snippet makes no sense. Your secound echo will not work as its invalid syntax. What is the correct syntax in the <div> tag to call that function?? Are you wanting to call that function when the user clicks on the div? This is not possible with PHP, PHP is unable to respond to events happening on the page. The only way you can do this is by using AJAX (using the xmlhttprequest object in javascript). You need to be more clear on what you're wanting to do. Quote Link to comment https://forums.phpfreaks.com/topic/163459-calling-php-function-from-tag/#findComment-862807 Share on other sites More sharing options...
n1tr0b Posted June 25, 2009 Share Posted June 25, 2009 oh sorry mate.. but its the simplest... but the 2nd echo has no " at the first Quote Link to comment https://forums.phpfreaks.com/topic/163459-calling-php-function-from-tag/#findComment-863262 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.