2016-03-31 2 views
0

ラジオボタンをステータスに入れる方法、2つのラジオボタン(承認済みと不承認)、およびチェックされたラジオボタンはステータスフィールドの下にデータベースに保存されます。 enter image description here出力表の中にラジオボタンを入れる方法は?

これは私のコード..です患者[6]あなたのステータスTD要素には、このTD要素の内容を置くべき状況

$sql = "select patientid, firstname, lastname, gender, patienttype, philhealth, status from patients where lastname LIKE '%" . $_POST["key"] . "%' or philhealth LIKE '%" . $_POST["key"] . "%' "; 
     $result = mysql_query($sql, $connection); 
     $rownum = 0; 
     $bgcolor = ""; 


     while($patient = mysql_fetch_array($result)) 
     { 
      $rownum += 1; 
      if($rownum == 2) 
      { 
       $bgcolor = "#FFF"; 
       $rownum = 0; 
      } 
      else 
      { $bgcolor = "#f9f9f9"; } 
      $approved_checked = $patient[6] == 'Approved' ? 'checked' : ''; 
      echo " 
      <tr id='" . $patient[0] . "' style='background: " . $bgcolor . "' onclick='openphilhealthapproval() '> 
        <td id='td27_cell1' style='height: 25px;'>" . $patient[5] . " </td> 
        <td id='td27_cell2' style='height: 25px;'>" . $patient[0] . "</td> 
        <td id='td27_cell3' style='height: 25px;'>" . $patient[1] . " " . $patient[2] . "</td> 
        <td id='td27_cell4' style='height: 25px;'>" . $patient[3] . "</td> 
        <td id='td27_cell5' style='height: 25px;'>" . $patient[4] . "</td> 
        <td id='td27_cell6' style='height: 25px;'>" . $patient[6] . "</td> 

       </tr> 
      "; 
     } 

答えて

0

です。また、HTMLをビルドするときに***patientID***記号をpatientIDに置き換える必要があります。作業例hereを見ることができます。

<td> 
     <input type="radio" name="statusradio***patientID***" value="approved" id="approvedradio***patientID***"/> 
     <label for="approvedradio***patientID***">approved</label> 
     <input type="radio" name="statusradio***patientID***" value="disapproved" id="disapprovedradio***patientID***"/> 
     <label for="disapprovedradio***patientID***">disapproved</label> 
</td> 
関連する問題