Home > php教程 > PHP开发 > The iframe tag implements form submission without page refresh (no js required) --- parsing

The iframe tag implements form submission without page refresh (no js required) --- parsing

高洛峰
Release: 2016-12-16 15:23:31
Original
1500 people have browsed it

Let’s look at a piece of code first (PHP example)

1. Form code (form.php)

<?php  
header("Content-type: text/html; charset=utf8");  
?>  
<iframe name="testIframeName" style="display:none;"></iframe>  
<form target="testIframeName" method="post" action="formAction.php">  
<input type="text" name="username"/>  
<input type="password" name="password"/>  
<input type="submit" value=" 提 交 " />  
</form>
Copy after login

2. Action code (formAction.php):

<?php  
echo "<script>alert(&#39;test....&#39;);</script>";  
?>
Copy after login

OK, the above code is very simple, but it realizes form submission without any problem. Refresh....Why is this?

Oh~ In fact, a very basic thing... is the attribute problem of the form tag... as shown in the picture:

The iframe tag implements form submission without page refresh (no js required) --- parsing


More iframe tags implement form form submission without page refresh (no page refresh) Requires js)---Please pay attention to the PHP Chinese website for parsing related articles!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template