关于php提交表单的问题

来源:百度知道 编辑:UC知道 时间:2024/05/28 08:38:38
为什么提交为空时,有请输入的提示,可上次输入的数据却正常提交到数据库
写入的页面:
<?php
require("../config_database.php"); //数据库
$text=$_POST['text'];
$image=$_POST['image'];

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>输入</title>
</head>

<body>
<?php
$error='';
if ($text=='') $error.="图片名称不能为空。<BR>";
if ($image=='') $error.="图片不能为空。<BR>";
i

file域要用$_FILES['image']['name']才能获取,并且form要有enctype="multipart/form-data"属性,否则你这个不能获取上传数据

这个东西还是用JS来判断比较好.....
干嘛不用JS来判断呢?