Home  >  Article  >  php教程  >  PHP提交表单

PHP提交表单

WBOY
WBOYOriginal
2016-06-06 16:04:031278browse

二种提交方式,提交到其它页面和提交到本身见代码:

<!DOCTYPE html>
<html>
<title>表单提交开始</title> 
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<body>
     返回首页
     <hr></hr>
<b>一、表单提交到另一个php上</b><br />
<form action="formTo.php" method="POST">
    Name:  <input type="text" name="username"><br />
    Email: <input type="text" name="email"><br />
    <input type="submit" name="submit" value="提交" />
</form>
<hr/>
<b>二、将一个表单 POST 给自己并在提交时显示数据:</b><br />
<br/>
<?php
if (isset($_POST['action']) && $_POST['action'] == 'submitted') {
    echo '<pre class="brush:php;toolbar:false">';

    print_r($_POST);
    echo '返回重填';

    echo '
'; } else { ?>
Name:
Email:
Beer:

Statement:
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