justlukeyou Posted March 6, 2011 Share Posted March 6, 2011 I have created a form which allows people to add data to a database. However, I want to replicate the form across several pages and give each page a category. For example, if I have a website based on sport. I have a page which enters information into the baseball category, a page which enters information into the ice hockey category, a page which enters information into the soccer category etc. Can someone advise how I would do this? Link to comment https://forums.phpfreaks.com/topic/229778-add-hidden-category-to-form/ Share on other sites More sharing options...
QuickOldCar Posted March 6, 2011 Share Posted March 6, 2011 Although you can add a hidden value in a form, how would it know which category to insert into? I would think using a form and letting them select a category would be the best way to go about this. I would additionally make an uncategorized for anything not falling into your specific categories or if they didn't select anything. http://www.w3schools.com/html/html_forms.asp I think a dropdown would be the best way, takes less room on the page. http://www.w3schools.com/html/tryit.asp?filename=tryhtml_select3 Then use the value from the POST or GET for your database insert of your category Link to comment https://forums.phpfreaks.com/topic/229778-add-hidden-category-to-form/#findComment-1183588 Share on other sites More sharing options...
justlukeyou Posted March 6, 2011 Author Share Posted March 6, 2011 OMG I got it to work. Once you get the hang of it PHP is so powerful!!! <input name="category" type="hidden" value="furniture" id="category" > Link to comment https://forums.phpfreaks.com/topic/229778-add-hidden-category-to-form/#findComment-1183594 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.