Jump to content

Calling php function from <div> tag


leaboy12

Recommended Posts

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?? :)

Link to comment
https://forums.phpfreaks.com/topic/163459-calling-php-function-from-tag/
Share on other sites

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.