Jump to content


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


Forms and calling Functions?

Recommended Posts

Hello All,

Im just after a bit of guidance i've been stuck on this for a while. I am using a read only textbox on a website drawing information form a mysql database hoping to fill the textbox.  Im hoping to either have a link or a button to call a php function that will increase a counter pulling the next bit of information captured from the database, but this is not the problem i can solve this.

The problem is I cant seem to figure out how in a form to have an onclick or even a link to call a php function within the webpage which is written in php. THis function will just call another line of code and refill the text box. I cant seem to figure out how to for e.g create nextthree(); with the click of a mouse, maybe ive spent to much time on it today.

Then again im thinking this perhaps should be done in Javascript after the database table has been taken through php but how to take the variable and contents from php and transfer them directy through to javascript.

Any guidance would be fantastic.

Kind Regards,


Share this post

Link to post
Share on other sites
You cannot run a PHP function when you click a link/button/image or whatever. PHP is not like javascript where you can fire a function when ever user clicks something. PHP runs on the server.

The only way to do it is by looking into a technique called pagination which you'll be able to adapt into your script. Or you can use javascript, however you'll want to look up on the HttpRequest method.

Share this post

Link to post
Share on other sites


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.