Page 1 of 1

searching for an array from a table.field

Posted: Fri Apr 04, 2008 12:20 pm
by glennn.php
given a Job Posting/Job Search script...

i have an array of checkboxes (Surgery, Optometry, Dentistry, etc...) that are imploded into an array of data and inserted into a table.field as part of a Job Posting.

Code: Select all

 
$checkbox1 = $_POST['specialty']; 
$string1 = implode($checkbox1,", "); 
$checkbox2 = $_POST['subspecialty']; 
$string2 = implode($checkbox2,", "); 
 
 
    $sql="INSERT INTO $tbl_user (username, password, specialty, subspecialty) 
VALUES (\"$_POST[username]\", \"$_POST[password]\", \"$string1\", \"$string2\")";
 
for the Job Search, i have the same array of checkboxes, of course, and i need to check the selected checkboxes against the database and return just the records that contain a particular value (Surgery, Dentistry, for instance)...

i know to do this:

$sql="SELECT * FROM $tbl_user WHERE specialty CONTAINS ($string1)";


but i don't know how to get the selected values into the Search query...



does that make sense?

appreciate any help!

GN