HTML button call php function

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
toppac
Forum Commoner
Posts: 29
Joined: Fri Jun 14, 2002 10:44 am

HTML button call php function

Post by toppac »

How can I make a button in html call a php function. I know in javascript you can do the Onclick method, can this be done with php as well?
qads
DevNet Resident
Posts: 1199
Joined: Tue Apr 23, 2002 10:02 am
Location: Brisbane

Post by qads »

maybe you can use this:

Code: Select all

<input type="Submit" value"function" name="call">

<?php
if(IsSet($Submit))
&#123;
function();
&#125;
?>
Jim
Forum Contributor
Posts: 238
Joined: Fri Apr 19, 2002 5:26 am
Location: Near Austin, Texas

Post by Jim »

of

Code: Select all

if($call)&#123;

//Create Function
myfunction()&#123;

function commands
&#125;

//Call Function
myfunction();
&#125;
Maybe?
toppac
Forum Commoner
Posts: 29
Joined: Fri Jun 14, 2002 10:44 am

Post by toppac »

Thanks guys these work, now i just need to debug my sql query :D

EDIT: I take that back, neither of these are working. Tried them both and they did not run the function. Any more ideas? Trying to run a function that will execute a SQL query.

Also why I am on it, how does php do a redirect or reload of a page.
Jim
Forum Contributor
Posts: 238
Joined: Fri Apr 19, 2002 5:26 am
Location: Near Austin, Texas

Post by Jim »

header("location:insert/url/here.com")

:)
Post Reply