0

So I got a website, and in the website I got an input field where I can search for a person and then get information about this guy. The person I search for is already in the database, so the searchbar is like a place where you can retrieve data for a specific person from the database. But, when I put the person name in the field :

 <input type="text" class="pure-input-rounded" id="form">
<button type="submit" class="pure-button" name="criteria">Search</button>

I get 0 result, and the MySQL SELECT code is:

$criteria = $_POST['criteria']; 
$sql = "SELECT Alder,Alias FROM motspiller WHERE  Name = '".$criteria."'";

(Name is the column name, and it's spelled correct)

The name of the person I write in the searchbar is 100% equal to the person's name in the database.

But when I change the criteria to a specific name from the database the result will display on the website.

So I'm wondering what the problem is? Why can't I put the name in the input field and get the information, instead I have to go into my php document and put in the names I want......

Drudge Rajen
  • 7,584
  • 4
  • 23
  • 43

1 Answers1

0

Instead of

<input type="text" class="pure-input-rounded" id="form">
<button type="submit" class="pure-button" name="criteria">Search</button>

do this

<input type="text" class="pure-input-rounded" name="criteria" id="form">
<button type="submit" class="pure-button" >Search</button>
Drudge Rajen
  • 7,584
  • 4
  • 23
  • 43