Page 1 of 1

Executing a PHP function from HTML

Posted: Tue Jan 11, 2005 8:50 am
by Hagar
I'm trying to execute a function from:
<input type="button" onClick="{execute script()}">

execute script() being the function name!! :?:

Posted: Tue Jan 11, 2005 8:59 am
by n00b Saibot
i think you have to remove the space in - execute script()
Replace with _ if you want the space in between ^

Posted: Tue Jan 11, 2005 9:04 am
by Jean-Yves
You either need to:

a) write the function as Javascript, as that is client side
or
b) call the php page that holds the function, eg onClick="window.location('myscript.php');"

HTH.

.

Posted: Tue Jan 11, 2005 9:10 am
by feyd
for the time being, PHP is server side, HTML is client side. They don't mix. i.e. HTML cannot call a php function as php has already finished processing the file once the HTML is output.

Jean-Yves has the right direction..