这是一个经典的PHP&Form入门例子,相信每个PHPer都很熟悉,回头想想,学习PHP就是这么一步一步走过来的:hello.html:<html><head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>An Example of PHP & Form</title></head><body> <h1>An Example of PHP & Form</h1> <br/> <form action='./response.php' method='post'> <table> <tr> <td>User Name : </td> <td><input type='text' name='username' size='20'/></td> </tr> <tr> <td></td> <td align=right> <input type='submit' value='Submit'/> </td> </tr> </table> </form></body></html>------response.php:<html><head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>An Example of PHP & Form</title></head><body> <h1>An Example of PHP & Form</h1> <br/> <?php $userName = $_POST['username']; echo "Welcome,{$userName}!<br/>"; ?></body></html>
转载请注明原文地址: https://ibbs.8miu.com/read-20207.html