searching for an array from a table.field

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
glennn.php
Forum Commoner
Posts: 41
Joined: Sat Jul 08, 2006 12:26 pm

searching for an array from a table.field

Post 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
Post Reply