button click

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
StyM
Forum Newbie
Posts: 2
Joined: Mon Dec 15, 2003 8:30 pm

button click

Post by StyM »

hello and good day.

i'm new to php, and i'm having a problem on how to make my button
call a php function???

thanks for the help.

here's my code, is this correct?????:

Code: Select all

<?php
  function clickme() &#123;
   print "button click";
  &#125;
?>

<html>
<head>
</head>
<body>
<input type="button" name="clickme" value = "Click me" onclick="clickme()"/>
</body>
</html>
User avatar
DuFF
Forum Contributor
Posts: 495
Joined: Tue Jun 24, 2003 7:49 pm
Location: USA

Post by DuFF »

Sorry, but you are using PHP as you would Javascript. The big difference between both of these is that PHP is server side, which means that it is all processed before it gets to the browser. Javascript on the other hand is client side and can change the browser in realtime. You will have to refresh the page to make the function say that the button clicked.

I would suggest that you read up on some tutorials for PHP:
http://www.php.net/tut.php
http://www.freewebmasterhelp.com/tutorials/php/
http://devshed.com/Server_Side/PHP/PHP1 ... page1.html

And always remember, PHP.net and Google are your friends :D
Post Reply