dimanche 9 août 2015

If string contains word, store into table?

I have a code with a checkbox array to store multiple selections in a single column I'm trying to write something that analyzes the checkbox variable to see if it contains a certain word or number, if it does, insert a second variable (studentid and the checkbox selection) in a new table

is that possible, and if not where did I go wrong ?

$name = $_GET['ckb'];
if(isset($_GET['ckb']))
{
foreach ($name as $coursess){
$cc=$cc. $coursess.',';
}
}

if (strpos($cc,'252000') !== false) {
    $sql5="INSERT INTO table (studentid, ckb)
    VALUES ('$studentid', '$cc')";
}




Aucun commentaire:

Enregistrer un commentaire