In PHP
<input type="checkbox" name="CBage" id="cbage2" value="and age >= 18 and age <= 24" checked/><label for="cbage2">18-24</label>
value="and age >= 18 and age <= 24"
After post action in php (i have tried)
$age1 = $_POST['CBage'];
$age = mysql_real_escape_string(implode(",", $age1));
or
$age = implode(",", $age1);
Table is created as
CREATE TABLE `jobs` (
`age` varchar(200) COLLATE utf8_unicode_ci
)ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
In mysql it insert as
INSERT INTO jobs VALUES ('$age')
The value inserted as follows
and age = 18 and age,and age = 25 and age,
The problem is that it doesn't insert the value correctly (its missing > < and some text in the end) as
"and age >= 18 and age <= 24" but rather it inserted as "and age = 18 and age,and age = 25 and age,"