simply how do you set enums in a database using coorsoponding radio button from a html form
now i have a table client_membership in mysql
with the membership_type enum('six','one')
i have html corrosponding radio button
6 months
1 year
i have also a Sql insert ignore that insert text field values into the SQLdbase
i want to write a php script that takes the html radio buttons and sets the enum values in the mysql database
to make it even simpler, i have some code that is similiar
this was taken from the wrox book , Beginning apache mysql php .....2005
[PHP] <?php
if ($enemies != '') {
$val = "";
foreach ($enemies as $key => $id) {
$val[] = "('$charid', '$id')";
}
$values = implode(',', $val);
if ($align = 'good') {
$cols = '(good_id, bad_id)';
} else {
$cols = '(bad_id, good_id)';
}
$sql = "INSERT IGNORE INTO char_good_bad_link $cols " .
"VALUES $values";
$result = mysql_query($sql)
or die(mysql_error());
}
?>[/PHP]
(comic fan site)
Can you noble professional coders explain how to adapt this code
i have tried already and have an idea how it is done but fail at every attempt
Cheers
Lazairus.
"Cast a cold eye ,on Life , on Death , Horseman Pass bye
W.B Yeats "