<html> <head> <title>xxx</title> <style> #tian{ color:blue; float:left; } </style> <body> <div id="tian"> <p>我喜欢你,虽然一直单相思</p> <br> <form method="POST" action="xs.php"> 我想说:<input type="text" name="usernmae"><br> <input type="submit" value="login"> </form> </div> </body> </html>
表单的代码
<?php function diaos() { if ($_POST['usernmae'] !="") { $username=$_POST['usernmae']; echo $username; } elseif ($_POST['usernmae'] =="我喜欢你") { echo '我也喜欢你'; } else { echo 'Error'; } } diaos(); ?>
php代码