search form using php HELP
Posted: Wed Aug 11, 2010 4:03 pm
FORM
<table border=0 cellpadding=2 cellspacing=0 width=900 align=center>
<tr align=right bgcolor=#ECE5B6>
<td>
<form target="_self" action="search.php" method="post"><b>
Search by:
<select name="drpdb">
<option value="RequesterFullName">Requester Name</option>
<option value="PhysicalServerName">Server Name</opton>
<option value="Create_Date">Create Date</optiuon>
</select>
Search: <input name="searchtxt" type="text">
<input type="submit" name="dosearch" value="Search">
</form></td></tr><b>
</table>
NO ERRORS , but please point out any problems i may here if you see it, thanks. Im stuck on the search.php file. Should i do a conditional statement, case or function. 2nd im not sure how the SQL query will be. Im using odbc to connect. Next the php file
search.php
Here is a copy of the code , just a snipet its reporting an error of
Parse error: syntax error, unexpected '"', expecting T_STRING or T_VARIABLE or T_NUM_STRING in "'""search.php on line 19
#Form Execution and Results
if($_GET['drpdb']=="RequesterFullName"){
$qa="SELECT RequesterFullName, Create_Date FROM Storage_Request WHERE RequesterFullName LIKE $_GET["searchtxt"]' ";
$result=odbc_exec($conn,$qa);
}
while(odbc_fetch_row($result)){
$RequesterFullName = odbc_result_all($result, 1);
$Create_Date = odbc_result_all($result, 2);
print("$RequesterFullName $Create_Date\n");
else if($_GET['drpdb']=="PhysicalServerName"){
$qb="SELECT PhysicalServerName , Create_Date FROM Storage_Request WHERE PhysicalServerName LIKE '($_GET['searchtxt'])' ";
$result=odbc_exec($conn,$qb);
}
while(odbc_fetch_row($result)){
$PhysicalServerName = odbc_result_all($result, 1);
$Create_Date = odbc_result_all($result, 2);
print("$PhysicalServerName $Create_Date\n");
}
?>
As you can see there a 2 different sql statements im trying, neither works. Line 19 is bolded. What is wrong with my sql query? Should i use conditionals to accomplish this? How do i display it, any help will be appreciated and thanks.
<table border=0 cellpadding=2 cellspacing=0 width=900 align=center>
<tr align=right bgcolor=#ECE5B6>
<td>
<form target="_self" action="search.php" method="post"><b>
Search by:
<select name="drpdb">
<option value="RequesterFullName">Requester Name</option>
<option value="PhysicalServerName">Server Name</opton>
<option value="Create_Date">Create Date</optiuon>
</select>
Search: <input name="searchtxt" type="text">
<input type="submit" name="dosearch" value="Search">
</form></td></tr><b>
</table>
NO ERRORS , but please point out any problems i may here if you see it, thanks. Im stuck on the search.php file. Should i do a conditional statement, case or function. 2nd im not sure how the SQL query will be. Im using odbc to connect. Next the php file
search.php
Here is a copy of the code , just a snipet its reporting an error of
Parse error: syntax error, unexpected '"', expecting T_STRING or T_VARIABLE or T_NUM_STRING in "'""search.php on line 19
#Form Execution and Results
if($_GET['drpdb']=="RequesterFullName"){
$qa="SELECT RequesterFullName, Create_Date FROM Storage_Request WHERE RequesterFullName LIKE $_GET["searchtxt"]' ";
$result=odbc_exec($conn,$qa);
}
while(odbc_fetch_row($result)){
$RequesterFullName = odbc_result_all($result, 1);
$Create_Date = odbc_result_all($result, 2);
print("$RequesterFullName $Create_Date\n");
else if($_GET['drpdb']=="PhysicalServerName"){
$qb="SELECT PhysicalServerName , Create_Date FROM Storage_Request WHERE PhysicalServerName LIKE '($_GET['searchtxt'])' ";
$result=odbc_exec($conn,$qb);
}
while(odbc_fetch_row($result)){
$PhysicalServerName = odbc_result_all($result, 1);
$Create_Date = odbc_result_all($result, 2);
print("$PhysicalServerName $Create_Date\n");
}
?>
As you can see there a 2 different sql statements im trying, neither works. Line 19 is bolded. What is wrong with my sql query? Should i use conditionals to accomplish this? How do i display it, any help will be appreciated and thanks.