How does php determine whether multiple post values are empty? this post is finally edited by gz109 from 2013-07-, for example, a form, multiple options, how can I use php to determine whether the value is null or the correct value? & lt; form & nbsp; action = "add. php "& nbsp; method =" p php how can I determine whether multiple post values are empty?
This post was last edited by gz109 at 17:37:50, for example, a form. There are many options. how can I use php to determine whether the value is null or a correct value?
$ Name1 = $ _ POST [name1];
$ Name2 = $ _ POST [name2];
$ Name3 = $ _ POST [name3];
$ Name4 = $ _ POST [name4];
$ Name5 = $ _ POST [name5];
// Insert the database. IF it is a single variable, you can use IF. what IF there are multiple variables?
If ($ name1 = ''){
Echo 'Enter the data ';
Exit;
}
$ SQL = "insert into book values ('$ name1', '$ name2', '$ name3', '$ name4', '$ name5 ')";
Mysql_query ($ SQL );
?>
Share:
------ Solution --------------------
// Set
$ _ POST = array ('name' => '', 'name2' => 'e', 'name3' => 'R', 'name4' => '', 'name5' => '');
$ T = array_keys ($ _ POST, ''); // if the space is not empty, use this
$ T = array_keys (array_map ('trim', $ _ POST), ''); // Use this parameter if the space is null.
If ($ t) {// empty data item
Print_r ($ t); // The value is an empty item.
}