Jump to content

php search form?


iphetamine

Recommended Posts

I have created a database and a table, was able to use php and mysql display the information onto a webpage using query, fetch_array, and loops.

 

Now I want to have a field (or search box?) so the user can enter the name of the product and it's related details appear. Does this require php forms or something like that?

Link to comment
https://forums.phpfreaks.com/topic/112485-php-search-form/
Share on other sites

Try this to get you started.

 

<form id="form1" name="form1" method="post" action="[b]getproduct.php[/b]">
  <label>
  <input name="product" type="text" id="product" />
  </label>
  <label>
  <input type="submit" name="Submit" value="Search Product" />
  </label>
</form>

 

 

The action is where you set the form too. all the values of the product field goes to the getproduct.php page, and use $_POST['product'] to get the value. Insert that into the query I posted earlier...

 

 

edit: Do some research on PHP search security too.

 

Link to comment
https://forums.phpfreaks.com/topic/112485-php-search-form/#findComment-577574
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.