PHP query database problems & lt; metahttp-equiv & quot; content-type & quot; content & quot; texthtml; charsetgb2312 & quot; & gt; & lt; formmethod & quot; post & quot; action & quot; search. php & quot; name & quot; PHP query database problems
@ $ Searchs = $ _ POST ['search'];
?>
The keyword you entered is:
Echo $ searchs;
?>
, The following are the search results:
If (isset ($ _ POST ['submit ']) {
$ Link = mysql_connect ('localhost', 'root', '123 ');
If (! $ Link ){
Die ('could not connect: '. mysql_error ());
} Mysql_select_db ('doctor ');
Mysql_query ("set names 'gb2312 '");
$ Query = mysql_query ("select * from doctor where doctor_id like '% $ searchs % '");
While ($ data = mysql_fetch_array ($ query )){
Echo $ data [1];
}};
?>
Output results cannot be displayed after a search. what is the problem?
I tried if (isset ($ _ POST ['submit ']) to use the search function. However, if I haven't searched, I will output all the results.
------ Solution --------------------
------ Solution --------------------
Your form does not have a control named submit.