# Php "onclick" run function and update anyone?

**URL:** <https://forum.kirupa.com/t/php-onclick-run-function-and-update-anyone/179391>\
**Category:** Uncategorized\
**Created:** [February 19, 2006, 7:41pm UTC](https://forum.kirupa.com/t/php-onclick-run-function-and-update-anyone/179391 "2006-02-19T19:41:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![earthcreature](https://avatars.discourse-cdn.com/v4/letter/e/dfb087/32.png) [@earthcreature](https://forum.kirupa.com/u/earthcreature)\
**Post date:** [February 19, 2006, 7:41pm UTC](https://forum.kirupa.com/t/php-onclick-run-function-and-update-anyone/179391/1 "2006-02-19T19:41:25Z")

</div>

As i understand wanting to do this in php is inherently silly, but i still want it to work.

i have a php function that i want to run and then update on the current page when the user clicks on an image or button. that’s my currrent road block, although there’s probably a better overall solution to my problem which is:

to automatically update a “current” file every 24 hours and then allow the user to browse foward and back through files accordingly.

right now this is how i have it working:

[http://michelleip.com/styxville/index.php](http://michelleip.com/styxville/index.php)

$file\_array = array  
(‘[http://www.michelleip.com/01.jpg](http://www.michelleip.com/01.jpg)’,  
‘[http://www.michelleip.com/02.jpg](http://www.michelleip.com/02.jpg)’,  
‘[http://www.michelleip.com/03.jpg](http://www.michelleip.com/03.jpg)’,  
‘[http://www.michelleip.com/04.jpg](http://www.michelleip.com/04.jpg)’,  
‘[http://www.michelleip.com/05.jpg](http://www.michelleip.com/05.jpg)’,  
‘[http://www.michelleip.com/06.jpg](http://www.michelleip.com/06.jpg)’,  
‘[http://www.michelleip.com/07.jpg](http://www.michelleip.com/07.jpg)’,  
‘[http://www.michelleip.com/08.jpg](http://www.michelleip.com/08.jpg)’,  
‘[http://www.michelleip.com/09.jpg](http://www.michelleip.com/09.jpg)’,  
‘[http://www.michelleip.com/10.jpg](http://www.michelleip.com/10.jpg)’,  
\<!–etc…–\>

$currentday = date(“j”);

$currentfile = “$file\_array[$currentday]”;

print ("\<IMG SRC=$currentfile\>");

\<!-- this is the part that i really need help with, i want the back(yesterday) and forward(tomorrow) arrows to run a php function that basically just says “display ++$currentfile or --$currentfile” and updates the current page, but also as users click back or forward repeatedly…–\>  
//////

print ("\<a onlclick= href="??yesterday"\>\<IMG SRC=“yesterday.jpg”\>\</a\>");

print ("\<a onlclick= href="??tomorrow"\>\<IMG SRC=“tomorrow.jpg”\>\</a\>");

i realize this could be a client side solution, but i’ve been doing everything in php and thought it would offer the cleanest solution, though i suspect i might need a little javascript. any illumination is greatly appreciated. thanks!
