Get input data from html form inside php function
by pizzipie from LinuxQuestions.org on (#566AT)
I am working on a program which includes a query to search for a partial name in a SQlite3 database. I need to get partial name input from the user to search for. Therefore I am trying to create a form inside a php function to get that data. Don't know whether this is possible.
Web Developer Tools Says " An error occurred: 200 OK " and shows the input form. How can I make this form available in the browser (firefox) so I can use the <input> to query the database?
Code:switch ($querytype) {
case "showdisplayname":
$query.=" ORDER BY `Display_Name`;";
break;
case "showfirstname":
$query.=" ORDER BY `First_Name`; ";
break;
case "searchforname":
$partname=getname();
$query.=" ORDER BY `First_Name`; ";
break;
case "showidaho":
$query.=" WHERE `State`='ID';";
break;
case "showarizona":
$query.=" WHERE `State` ='AZ';";
break;
case "showstate":
$query.=" ORDER BY `State` desc ;";
break;
case "again":
gotoselectQuery();
exit();
break;
case "exit":
gotoindex();
exit();
break;
default:
$query="SELECT * FROM ".$table. " WHERE 1";
} // switchHere is the function getname():
Code:function getname() {
echo '<!DOCTYPE HTML>';
echo "<html>";
echo '<form action=# method="POST">';
echo 'Partial Name: <input type="text" name="username">';
echo '<input type="submit">';
echo '</form>';
echo "</html>";
}


Web Developer Tools Says " An error occurred: 200 OK " and shows the input form. How can I make this form available in the browser (firefox) so I can use the <input> to query the database?
Code:switch ($querytype) {
case "showdisplayname":
$query.=" ORDER BY `Display_Name`;";
break;
case "showfirstname":
$query.=" ORDER BY `First_Name`; ";
break;
case "searchforname":
$partname=getname();
$query.=" ORDER BY `First_Name`; ";
break;
case "showidaho":
$query.=" WHERE `State`='ID';";
break;
case "showarizona":
$query.=" WHERE `State` ='AZ';";
break;
case "showstate":
$query.=" ORDER BY `State` desc ;";
break;
case "again":
gotoselectQuery();
exit();
break;
case "exit":
gotoindex();
exit();
break;
default:
$query="SELECT * FROM ".$table. " WHERE 1";
} // switchHere is the function getname():
Code:function getname() {
echo '<!DOCTYPE HTML>';
echo "<html>";
echo '<form action=# method="POST">';
echo 'Partial Name: <input type="text" name="username">';
echo '<input type="submit">';
echo '</form>';
echo "</html>";
}