Page 1 of 1

button click

Posted: Mon Dec 15, 2003 8:30 pm
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>

Posted: Mon Dec 15, 2003 8:38 pm
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