0

Hello,

I have to appologize but I am very new to programing and web developemnt. I have developed a web site that will allow users to register and store their info in an database. I am using webmatrix to put it all together. I have no problem adding the info to the DB, but I am struggling with how to search through it. I would like for a user to be able to enter search criteria into any, or all or 4 different forms that correspond to 4 different columns in the db. I would like the resulting rows containing a union of all info in forms to be displayed, with blank forms being a wildcard. Can anyone help me? I have no idea where to start besides creating the HTML forms and writing the PHP to open the DB and define the columns I want to search as variables.

3
Contributors
2
Replies
4
Views
5 Years
Discussion Span
Last Post by liquidbroadcast
2

Here are some hints:

  • when coding a form use name attributes that match column names
  • decide whether use post or get method (post is slightly more secure, get can be easily bookmarked or saved)
  • in any case clean the input before using it in a query (use at least escaping)
  • use SELECT query to search and WHERE condition to limit search for the fields that have entered search terms
  • decide if you allow partial matching of text fields (use % wildcards in a query)
  • decide if you allow ranges for numeric and date values
  • if you want to use full text search the table engine has to be of the correct type (MyISAM for mySql)
  • store search values so you can autofill-in the form after the search has been performed
0

I was just trying to get an idea how this is done.But Thanks you have made it easy by giving some hints.
Great job.well done.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.