繁体   English   中英

如何从表单获取数据并将其发布到iframe中以模拟论坛?

[英]How to get data from a form and post it into iframe to emulate a forum?

所以我有一个表格 ...

<fieldset>
<legend>Post a comment:</legend>
<form target="forum" method="post" action="forum.**SomeKindOfExtension**" >
                Name: <br />
        <input type="text" name="fname" /><br />
                Subject:<br />
        <input type="text" name="subject" size="50"/><br />
                Comment:<br />
<textarea name="comment" rows="10" cols="100">Hello,</textarea><br />
<input type="submit" value="Send" />
<input type="reset" value="Reset" />
</fieldset>
</form>

然后,我想获取数据 (名称,主题和注释), 然后单击按钮 <input type="submit" value="Send" />将其放入iframe中 ...

iframe与表单位于同一页面(在其下方),看起来像这样...

<iframe name="forum" src="forum.**SomeKindOfExtension**" 
width="900" height="500" ></iframe>

使用PHP意味着将表单提交到服务器,服务器将刷新整个页面,而不仅仅是刷新所有需要刷新的iframe,所以我想Javascript会更好。

输入文本数据后,我希望iframe将数据永久存储在那里。 基本上就像是iframe中的论坛。

我不确定这是否是最好的解决方法,但是任何帮助将不胜感激。 谢谢。

提交表单到PHP文件( action="yourfile.php" ),但在你的形式针对 iframe中。 在服务器上处理表单并吐出结果。 它将显示在iframe中。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM