-2
I would like to know how to call a php code on a button that triggers an iframe, and this code should be opened in iframe.
-2
I would like to know how to call a php code on a button that triggers an iframe, and this code should be opened in iframe.
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 iframe, then use the src
for the PHP file or integrate it to the page you need. If you need to pass some variable through the URL, just do it through the src
and capture the information by $_GET
in PHP.
0
You can activate iframe and set its src dynamically as in this jsfiddle I just did: http://jsfiddle.net/Te7ps/
-1
Well, without too 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
}
?>
You came to read and interpret her question?
Yeah, now she’s just adapting to what she wants and needs, this is no place for ready-made code.
I don’t think your code is adaptable to the need for it... You just made a form that calls a get request.
But it’s not calling code in PHP?
Her main interest is to use iframe, which was not mentioned in her reply. rs
If she doesn’t know how to implement iframe there... it’s complicated. Correct the answer and I edit.
Browser other questions tagged javascript php html5
You are not signed in. Login or sign up in order to post.
Can you give more details? Already have the HTML button and iframe? Have any attempts already made?
– bfavaretto
Yes already have, I made a function with a Document.getElementById cm php code put a button with the function I created and parentese getelement I put the id of iframe, but it does not work
– ClaraBatt
So, could you edit the question with the code you already tried? The most abridged possible version of it, only to reproduce the problem.
– bfavaretto