iphetamine Posted June 29, 2008 Share Posted June 29, 2008 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 More sharing options...
trq Posted June 29, 2008 Share Posted June 29, 2008 Does this require php forms or something like that? Forms are made using html. You might find the chapter on dealing with forms in the book linked to in my signiture usefull. Link to comment https://forums.phpfreaks.com/topic/112485-php-search-form/#findComment-577554 Share on other sites More sharing options...
phpSensei Posted June 29, 2008 Share Posted June 29, 2008 Enter the name of the product requires a form, form field, and submit button. Then you process the form by taking the details and inputting in a query. http://www.htmlite.com/mysql011.php edit: Yes forms are HTML not PHP. Link to comment https://forums.phpfreaks.com/topic/112485-php-search-form/#findComment-577555 Share on other sites More sharing options...
iphetamine Posted June 29, 2008 Author Share Posted June 29, 2008 So basically I need to have a .html file and a .php file. And the .html file is linked to the .php file? I'll take a look at some of the stuff you guys mentioned, thanks. Link to comment https://forums.phpfreaks.com/topic/112485-php-search-form/#findComment-577568 Share on other sites More sharing options...
phpSensei Posted June 29, 2008 Share Posted June 29, 2008 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.