Executing a PHP function from HTML

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Hagar
Forum Newbie
Posts: 18
Joined: Mon May 20, 2002 3:28 am
Location: Johannesburg, South Africa

Executing a PHP function from HTML

Post by Hagar »

I'm trying to execute a function from:
<input type="button" onClick="{execute script()}">

execute script() being the function name!! :?:
User avatar
n00b Saibot
DevNet Resident
Posts: 1452
Joined: Fri Dec 24, 2004 2:59 am
Location: Lucknow, UP, India
Contact:

Post by n00b Saibot »

i think you have to remove the space in - execute script()
Replace with _ if you want the space in between ^
User avatar
Jean-Yves
Forum Contributor
Posts: 148
Joined: Wed Jul 02, 2003 2:13 pm
Location: West Country, UK

Post 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.

.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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..
Post Reply