こんにちは、私は私は本当に近いと思うが、ちょうどカントは私の文が正しくエコーmysqlのフィールドステートメント
の作業を取得するように見える私は、私は、MySQLから残業フィールドを持っていると私はそれを表示することができますが、私ならばチェックされているかチェックされていないかは、チェックされている場合は1、チェックされていない場合は0です。私はテキストフィールドに1または0を表示することができますが、チェックボックスは私にとってはうまくいかないでしょう。
echo '<td> Overtime <input type="checkbox" name="chg_hrs_ovt[]" <? if($list_hours["overtime"]==1){ echo "checked=checked"} ?> >';
私の完全なコード:
<?
// This next section is to load the text fields from the mysql
// this is to collect all of the logged hours on the job sheet and then display
// the hours already entered.
$hours_query = "SELECT * FROM hours where job_number = '$job_number'";
$hours_result= ($mysqli-> query($hours_query));
// this next section collects the data from the parts table and then adds it to an array
// this then goes into a while statement until it has displayed all of the results it has
// depending on how many parts were used
while ($list_hours = mysqli_fetch_array($hours_result))
{
echo " <table border ='0' table width = 70%>";
echo '<td> <input type="hidden" name="chg_hrs_id[]" value="'.$list_hours['unique_id'].'">';
echo '<td> Start Time <input type="time" name="chg_hrs_str[]" value="'.$list_hours['start_time'].'" >';
echo '<td> Finish Time <input type="time" name="chg_hrs_fin[]" value="'.$list_hours['finish_time'].'">';
echo '<td> Date Of Work <input type="date" name="chg_hrs_date[]" value="'.$list_hours['date'].'">';
echo '<td> Ovt Boolean <input type="ovt_Booloean" name="chg_hrs_ovtb[]" value="'.$list_hours['overtime'].'">';
echo '<td> Overtime <input type="checkbox" name="chg_hrs_ovt[]" <? if($list_hours["overtime"]==1){ echo "checked=checked"} ?> >';
echo "</tr>";
}
echo "</table>";
?>
なぜ '$ hours_result =($ mysqli-> query($ hours_query));' – RiggsFolly
のすべての余分な中かっこはPHPのオープン文字 "<?"を使用しています。 "エコー"で。前のすべてのエコーでそれをしたように、ドットを使用してみてください。 http://stackoverflow.com/a/3507055/5524279 –
こんにちはRiggsFolly私はちょっとした騒ぎですので、うまくいく傾向があります。私はいつもその理由を理解していません。 –