Jump to content

Search ??


Sarahc

Recommended Posts

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

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 again
Ray
Link to comment
https://forums.phpfreaks.com/topic/30793-search/#findComment-141958
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.