Call php code on button [closed]

-2

I would like to know how to call a php code in a button that triggers an iframe, and that code should be opened in the iframe.

    
asked by anonymous 08.04.2014 / 15:54

3 answers

2

To call a PHP code after clicking this button, use an AJAX request for the desired PHP file.

If the code should be executed in the iframe, then use src for the PHP file or integrate it with the page you need. If you need to pass a variable through the URL, just do it by src and capture the information by $_GET in PHP.

    
07.05.2014 / 15:49
0

You can enable the iframe and set the src of it dynamically as in this jsfiddle that I just did: link

    
09.04.2014 / 03:29
-1

Well, without much ado:

<?php
if (!empty($_GET['act'])) {
  echo "Olá, Stack Overflow!"; //Seu código vai aqui, enfim...
} else {
?>
(.. html ..)
<form action="index.php" method="get">
  <input type="hidden" name="act" value="run">
  <input type="submit" value="Clique aqui!">
</form>
<?php
}
?>
    
08.04.2014 / 17:13