got a couple of issues here with setting up checkboxes - and radio buttons - first of all - when i submit it, the check boxes never return the values that i've inputed in them (in this case, checked) - they still return the same list with check boxes, but this time, unchecked - whereas the ones i want checked before submitting are not shown checked the second time...what do I do?
i'm confused!
here's a link to the image attached - http://ift.tt/1wKobzt link description here][1]
and I want it to show ticked check boxes after I submit them...here's the code for that below -
<br><br>
<H2 align="center">SKILLS SET</H2>
<br>
<label for="skills" size="3">Pick Your Skill(s): </label>
<br><br>
<tr>
<table border='1' cellspacing='0'>
<colgroup>
<col span='1'>
</colgroup>
<tr><td>Engineering Services
</td>
<td>Information Technologies
</td>
<tr>
<td valign="top">
<?php
$list = "SELECT * FROM skillsset WHERE category='Engineering' ORDER BY skills ASC";
//$list = "SELECT * FROM specifications ";
//$list1 = "SELECT * FROM specifications ORDER BY category ASC Limit 2";
$listAHI = $dbs ->prepare($list);
$listAHI -> execute();
//while($row1 = $listAHI1 ->fetch(PDO::FETCH_ASSOC)){
while($row = $listAHI ->fetch(PDO::FETCH_ASSOC))
{
$skills = $row["skills"];
$category = $row["category"];
echo "
<input type='checkbox' name='skills[]' value='$skills'> $skills<br>
";
//$category = $row["category"];
//$specifications = $row["specifications"];
//echo "$category <input type='checkbox' name='$specifications' value='$specifications'> $specifications </td>";
}
//while($row1 = $listAHI1 ->fetch(PDO::FETCH_ASSOC)){
//$category = $row1["category"];
//echo "<input type='checkbox' name='$specifications' value='$specifications'> $specifications ";
//echo "$category";
?>
</td>
<td valign="top">
<?php
$list = "SELECT * FROM skillsset WHERE category='Information' ORDER BY skills ASC";
//$list = "SELECT * FROM specifications ";
//$list1 = "SELECT * FROM specifications ORDER BY category ASC Limit 2";
$listAHI = $dbs ->prepare($list);
$listAHI -> execute();
//while($row1 = $listAHI1 ->fetch(PDO::FETCH_ASSOC)){
while($row = $listAHI ->fetch(PDO::FETCH_ASSOC))
{
$skills = $row["skills"];
$category = $row["category"];
echo "
<input type='checkbox' name='skills[]' value='$skills'> $skills<br>
";
//$category = $row["category"];
//$specifications = $row["specifications"];
//echo "$category <input type='checkbox' name='$specifications' value='$specifications'> $specifications </td>";
}
//while($row1 = $listAHI1 ->fetch(PDO::FETCH_ASSOC)){
//$category = $row1["category"];
//echo "<input type='checkbox' name='$specifications' value='$specifications'> $specifications ";
//echo "$category";
?>
</td>
</tr>
</table>
What do I gotta do to make this work properly? thnx a mill!! I want it to look like something in the image below after I click the submit button -
where did I go wrong?
For text input - I used the following code - value=""
however, for checkboxes, if I use that code, it gives me an error because 1. it's a check box and 2. it's being printed from a string which retrieves the list from a databse in php my admin...so how am I able to make it return the previously checked boxes after I click submit or save the data? thnx a mill once again!!!
Aucun commentaire:
Enregistrer un commentaire