butterflybill Posted January 6, 2010 Share Posted January 6, 2010 In a HTML document, you can put in a <input type="button" and then use the onClick to = a javascript function that you have in your header or external .js file. Can you do the same thing with a php function in a php file? Do you have to </php in and ?> out somewhere among the HTML tags? Do you have to define the function in a certain place? I am trying to get it to call up a function that includes sending me an email with mail("etc") when the viewer clicks on it, and I can't get it to work. Link to comment Share on other sites More sharing options...
ShadowMage Posted January 6, 2010 Share Posted January 6, 2010 HTML and JavaScript are client side scripts while PHP is server side. So no you can't directly call a PHP function from HTML. You could probably use JavaScript to do an AJAX request and perform whatever PHP function you need to do, though. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.