Jump to content

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.