在iframe中获取php文件 [英] Getting a php file in an iframe

查看:343
本文介绍了在iframe中获取php文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个文件,一个是 index.php ,其中包含一个提交给abc.php的表单。现在问题在 index.php 我希望在将表格提交到 abc.php 后显示我得到的数据。我试过但我不能希望我能提到所需要的所有内容。任何建议将不胜感激。

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.

推荐答案

设置表单的目标( 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
}
?>

这篇关于在iframe中获取php文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆