Skip to main content
Known Participant
September 29, 2006
Question

Using Radio Button for Search

Hi,
I'm doing a Search function which consists of a category which i which to use radio buttons.
E.g. 4 Radio buttons.
Category A
Category B
Category C
Category D
and some other controls like a menu and a text box.. (which consists of the other criterias i need for the search...)
I was able to do the SQL on the menu. I retrieve the selected value in the menu and do a SQL to display the results.
But how could I get the radio button to do the same thing?

These radio buttons are actually tables in my database . (E.g Category A is a table in my database, Category B is another table....)

I did the SQL for the menu and the textbox like this...
my menu name is : myMenu
my textbox name is : myTxt
and on the next page, which is my results page, i add a recordset like this...

SELECT *
FROM CategoryA
WHERE colOne like '%varOne%' and colTwo like '%varTwo%'

with the variables added ...
name: varOne | default value: -1 | run-time value: $_POST['myMenu']
name: varTwo | default value: -1 | run-time value: $_POST['myTxt']

I need to add another variable which represents the table of my database. which the value is get from the radio button selected by the user..

and Another Question is when i put 3 where conditions it gave me an sql error when i preview and run it in IE...
(e.g. select * from mytable where colOne like '%abc%' and colTwo like '%aaa' and colThree like '%xyz%' )

Please help me on the 2 problems...

Thanks!

This topic is closed to new replies. Start a new post to keep the conversation going.

2 replies

J-GirlAuthor
Known Participant
September 29, 2006
Please Read the above message before reading this.

Regarding the above situation of writing a sql with 3 conditions.
this is the error IE showed when i use 3 where conditions.

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'like '%%') LIMIT 0, 20' at line 1
Translate
J-GirlAuthor
Known Participant
October 2, 2006
Anyone could kindly help me?
Read the above 2 posts and give me some help.
Thanks.
Translate