Sarahc Posted December 15, 2006 Share Posted December 15, 2006 I am sure this is simple, please forgive me I am new at this. I have a database with recipes and it has fields named gluten and casein which I filled with the value 0 or 1 (0 for contains gluten, 1 for gluten free) I want to add a search that has for "gluten free" and or "casien free" check a radio button.How do I do that?TIA!!Sarah Link to comment https://forums.phpfreaks.com/topic/30793-search/ Share on other sites More sharing options...
complex05 Posted December 15, 2006 Share Posted December 15, 2006 FORM<input tyep="radio" name="gluten" value="1">Contains Gluten <input type="radio" name="gluten" value="0">Gluten FreeMySQL QuerySELECT * FROM recipies WHERE gluten=$gluten Link to comment https://forums.phpfreaks.com/topic/30793-search/#findComment-141957 Share on other sites More sharing options...
craygo Posted December 15, 2006 Share Posted December 15, 2006 Just a personal opinion, but I would use 0 for NO and 1 for YES. Just a quick something to think about.Now to do this on your form page. change the value to 0 if you do not do what I said above.[code]Gluten:<input type=radio name=gluten value=1> Gluten Free: <input type=radio name=gluten value=0>[/code]now on your sql page[code]$gluten = $_POST['gluten'];$sql = "SELECT * FROM tablename WHERE gluten = '$gluten'";[/code]EDIT: damn beat me againRay Link to comment https://forums.phpfreaks.com/topic/30793-search/#findComment-141958 Share on other sites More sharing options...
complex05 Posted December 15, 2006 Share Posted December 15, 2006 [quote author=craygo link=topic=118785.msg485661#msg485661 date=1166213834]EDIT: damn beat me againRay[/quote]I win :) Link to comment https://forums.phpfreaks.com/topic/30793-search/#findComment-141961 Share on other sites More sharing options...
Sarahc Posted December 15, 2006 Author Share Posted December 15, 2006 but how would I call it like:[b]Search:[/b]choosegluten free: yes nocasein free: yes noresults:Am I making sense? I guess my question is how to display the recipes in this catagories as oppossed to how to post it.another chance craygo! :D Link to comment https://forums.phpfreaks.com/topic/30793-search/#findComment-142009 Share on other sites More sharing options...
Sarahc Posted December 16, 2006 Author Share Posted December 16, 2006 anyone? Link to comment https://forums.phpfreaks.com/topic/30793-search/#findComment-142203 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.