Skip to content
Advertisement

Multiple Fields search MySQL database using php

I’m almost there, my code it doesn’t show any results.
it’s a basic form where users search by postcode and property type.
they should be able to search by entering only the postcode or both.
I’m working in localhost php7
here the html

JavaScript

here the php

JavaScript

database here

Advertisement

Answer

$type like '%$postcode%' is invalid code for multiple reasons. You need to build the search criteria based on the values coming from the form.

Here is how the code should look like properly:

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement