I'm actually learning Javascript and especially Iframes.
So I made a form which is checked by request.php
and then sent to my iframe via target : framename.php
with a function wich update my iframe.
The problem is that my frame doesn't update, and I have no console message.
I show you the code :
index.php
<form id = "welcome" action = "request.php" target = "hello" method="post">
<label for = "welcomeMsg"> Message : </label>
<input id = "welcomeMsg" name = "welcomeMsg" type = "text"/>
<input type = "submit" value = "send" />
</form>
<iframe src = "hello.php" id = "hello" name = "hello"></iframe>
<script>
function sayMsg(welcomeMsg){
var frame = document.getElementById('hello').contentDocument;
frame.innerHTML = welcomeMsg;
}
</script>
request.php
<script>
window.top.window.sayMsg("<?php echo $_POST['welcomeMsg']; ?>");
</script>
hello.php (iframe)
<p id = "mess"> Hello </p>
You may think 'Why are you using a html page as an iframe because an id would work', it is because I will customise this hello.php.