验证php页面,因为每个字段都必须填写 [英] validate the php page as every field must be filled

查看:62
本文介绍了验证php页面,因为每个字段都必须填写的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

require_once("config.php");
if(isset($_GET['add']))
  {
$first_name=$_GET['first_name'];
//echo $first_name;
$last_name=$_GET['last_name'];
$emp_code=$_GET['emp_code'];
$salary=$_GET['salary'];
$age=$_GET['age'];
$date_of_joining=$_GET['date_of_joining'];
$date_of_birth=$_GET['date_of_birth'];
$dept_id=$_GET['dept_id'];
$manager_id=$_GET['manager_id'];
mysql_query("INSERT INTO emp (first_name , last_name , emp_code , salary , age , date_of_joining , date_of_birth , dept_id , manager_id ) values('$first_name' , '$last_name' , '$emp_code' , '$salary' , '$age' , '$date_of_joining' ,'$date_of_birth' , '$dept_id' , '$manager_id')");


 
/*if ($_FILES["file"]["size"] < 50000)
  {
  if ($_FILES["file"]["error"] > 0)
    {
    echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
    }
  else
    {
    echo "Upload: " . $_FILES["file"]["name"] . "<br />";
    echo "Type: " . $_FILES["file"]["type"] . "<br />";
    echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
    echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />";

    if (file_exists("upload/" . $_FILES["file"]["name"]))
      {
      echo $_FILES["file"]["name"] . " already exists. ";
      }
    else
      {
      move_uploaded_file($_FILES["file"]["tmp_name"],
      "/home/hariprasad/Desktop/html" . $_FILES["file"]["name"]);
      echo "Stored in: " . "/home/hariprasad/Desktop/html" . $_FILES["file"]["name"];
      }
    }
  }
else
  {
  echo "Invalid file";
  }*/



}

?>
<html>
<head>
<style type="text/css">
body
{
background-color:#b0c4de;
}
</style>


</head>
<body>
<center>
<h1>EMPLOYEE FORM</h1>
<table>


				        <form name="addemp" method="get" action=" ">
<tr><td>First name        </td><td>		<input type="text" name="first_name"></td></tr>
<tr><td>Last  name	     </td><td>     <input type="text" name="last_name"></td></tr>
<tr><td>Employee code     </td><td>    <input type="text" name="emp_code"></td></tr>
<tr><td>Salary   		  </td><td>     <input type="text" name="salary"></td></tr>
<tr><td>Age			      </td><td>     <input type="text" name="age"></td></tr>
<tr><td>Date of joining   </td><td>     <input type="text" name="date_of_joining"><table><tbody><tr><table><tbody><tr><table><tbody><tr><table><tbody><tr><td></td></tr></tbody></table></tr></tbody></table></tr></tbody></table></tr></tbody></table></td></tr>
<tr><td>Date of birth	  </td><td>     <input type="text" name="date_of_birth"><table><tbody><tr><table><tbody><tr><table><tbody><tr><table><tbody><tr><td></td></tr></tbody></table></tr></tbody></table></tr></tbody></table></tr></tbody></table></td></tr>
<tr><td>Department id     </td><td>     <input type="text" name="dept_id"><table><tbody><tr><table><tbody><tr><table><tbody><tr><table><tbody><tr><td></td></tr></tbody></table></tr></tbody></table></tr></tbody></table></tr></tbody></table></td></tr>
<tr><td>Manager id	      </td><td>     <input type="text" name="manager_id"><table><tbody><tr><table><tbody><tr><table><tbody><tr><table><tbody><tr><td></td></tr></tbody></table></tr></tbody></table></tr></tbody></table></tr></tbody></table></td></tr>
 				        <tr><td><label for="file">Attach ur bioa data:</label></td></tr>
                       <tr><td> <input type="file" name="file" id="file" /></td></tr>
                        <tr><td><input type="submit" name="add" value="ADD"/></td></tr>
				        </form>

</table></center>
</body>
</html>

推荐答案

_GET [' 添加'])) {
_GET['add'])) {


first_name =
first_name=


_GET [' // echo
_GET['first_name']; //echo


这篇关于验证php页面,因为每个字段都必须填写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆