Jump to content

femiot

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

femiot's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Please guys, I need your help on this one. How can call the data from mysql and make the values checked on the checkboxes Have got three tables. I am retrieving data and updating two tables at once...
  2. thanks guys... Have actually sorted it out. $result = mysql_query("SELECT * FROM course") or die(mysql_error()); if ($result){ while ($row = mysql_fetch_array($result)){ $checked = 'unchecked'; if ($_POST['courses'] != "") { if (isset($_POST['courses'])){ if (in_array($row['cid'], $_POST['courses'])){ $checked = "checked"; } } } echo "<input type=\"checkbox\" name=\"courses[]\" value=\"$row[cid]\" $checked >$row[cname]\n"; } } thanks once again
  3. Am new to php... I have been battling on my dynamic checkboxes in such a way that if none is checked the form is return, also I need to retain what was checked when the form postback due to other invalid inputs. $result = mysql_query("SELECT * FROM course") or die(mysql_error()); if ($result) { while ($row = mysql_fetch_array($result)){ if (isset($_POST['courses']) and $_POST['courses'] == $row['cid']) {echo $row['cid'];} print "<input type=\"checkbox\" name=\"courses[]\" value=\"$row[cid]\">$row[cname]\n"; } } Help needed purely on php codes. Thanks in advance
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.