Getting a php file in an iframe

别等时光非礼了梦想. 提交于 2019-12-12 05:39:44

问题


I have two files one is index.php which contains a form which gets submitted to abc.php.Now the problem is have a frame in index.php where in i want to display the datas that i got after submitting the form to abc.php.I tried but m not able to it.Hope i hav mentioned all the thngs required. Any suggestion will be appreciated.


回答1:


Set your form's target (phpfiddle demo):

<?php
if(!empty($_POST['submit_to_frame']))
{
    echo htmlspecialchars($_POST['the_data']);
}
else
{
?>
<iframe id="the_frame" name="the_frame"></iframe>
<form method="POST" target="the_frame">
    <input type="hidden" name="submit_to_frame" value="true" />
    <input type="text" name="the_data"/>
    <input type="submit" value="OK">
</form>
<?php
}
?>


来源:https://stackoverflow.com/questions/14428079/getting-a-php-file-in-an-iframe

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!