1

I have used the following code to search matching record from MYSQL database using HTML, PHP codes below all form element or textboxes works fine except this one. Its is very unusual for me i have spent a lot of time to identify what caused it but i cant see anything.

//inside HTML Form

  <tr>
    <td> 
     <label id="lbl_auto_year" for="auto_year" class="" >Search By Tread pattern:<br/>
     <input type="text" value="<?php echo htmlspecialchars($_REQUEST['pattern']); ?>" class="form-control input-sm" autocomplete="off" name="pattern" id="pattern" style="width:200px;color:#000;background:#fff" >
   </td>
 </tr>

//Requested as

  $txtpattern = $_REQUEST['pattern'];    

//if staement

  elseif (($row['Tread_Design']==$txtpattern || preg_match("/\b".preg_quote($txtpattern )."\b/i", $row['Tread_Design']) && ($size1=="" && $txtsize==""))
{
   echo "<td style=' width:300px;text-align:left; padding-left: 10px;vertical-align: middle;'>";echo $row['Manufacturer'];echo"</td>";
    echo "<td style=' width:150px;  text-align:left; padding: 10px;vertical-align: middle;'>";echo $row['Brand_Name'];echo"</td>";


 }

It doesn't give me any error but it doesnt display any result i know there are matching records in the database.

The funny part is when i change textbox name from name="pattern" to name="txtsize"(which already exist in the same form and working fine) i get the right result. I am not sure how that happens

Thamilhan
  • 12,351
  • 5
  • 33
  • 59
user5225773
  • 125
  • 9

0 Answers0