php简单框架的应用实例

<html>

<frameset rows="50%,50%">

<frame src="/Test/header.php">

<frameset cols="25%,75%">
<frame src="/Test/collect.php">
<frame src="/Test/view.php">
</frameset>

</frameset>

</html>

 


header.php
<html>
<head>
</head>
<body>
<h1>
管理员登录界面</h1>
</body>
</html>

collect.php
<html>
<head>
</head>
<body>
员工号:<input type="text"></input>
<button type="button"value="查询">查询</button>
</body>
</html>

view.php
<html>
<head>
</head>
<body>
<p>This is the View.
</body>
</html>

 

POST GET test

<html>

<body>

<?php

<form action="success.php" method="post">

  Name:<input type="text" name="name"><br>

  pwd:<input type="password" name="pwd"><br>

<input type="submit">

</form>

?>

</body>

</html>

 

success.php

<html>

<body>

<?php

welcome<?php echo $_POST["name"];?>

?>

</body>

</html>

form_check

 

<!DOCTYPE html>

<html>

<head>

<style>

.class{#ff000};

</style>

</head>

<body>

<h2>PHP  form check</h2></br>

<span class="error">necessary message</span></br> 

<form action="check.php" method="post">

Name:<input type="text" name="name"><span class="error"><?php echo $nameErr;?></span></br>

Email:<input type="text" name="email"><span class="error"><?php echo $emailErr;?></span></br>

Web:<input type="text" name="web"></br>

Comment:<input type="textarea" name="comment"></br>

Gender:<input type="radio" name="gender">male &nbsp<input type="radio" name="gender">female <?php echo $genderErr;?></br>

<input type="submit">

</form>

</body>

</html>

 

check.php

 

<!DOCTYPE html>

<html>

<head>

</head>

<body>

<?php

    $nameErr=$emailErr=$genderErr=$webErr="";

    $name=$email=$gender=$web="";

     if($_SERVER["REQUEST_METHOD"]=="POST"){

      if(empty($_POST["name"])){

      $nameErr="Name is necessary";

        }else{

        $name=test_input($_POST["name"]);}

      if(empty($_POST["email"])){

      $emailErr="email is necessary";

        }else{

        $email=test_input($_POST["email"]);}

     

     if(empty($_POST["web"])){

      $webErr="email is necessary";

        }else{

        $web=test_input($_POST["web"]);}

     

     if(empty($_POST["gender"])){

      $genderErr="email is necessary";

        }else{

        $gender=test_input($_POST["gender"]);}

}

?>

<?php

echo"<h1> Your input is:</h1>"</br>

echo $name;

echo "<br>";

echo $email;

echo "<br>";

echo $web;

echo "<br>";

echo $comment;

echo "<br>";

echo $gender;

echo "<br>";

?>

</body>

</html>

posted @ 2016-08-16 11:23  小野猪  阅读(907)  评论(0编辑  收藏  举报