0
viewsessions.php
で、私はdbから複数の値を選択して、それを<input type="checkbox" name="example" id="example">
または類似のJQueryモバイルを使用してグループ化されたチェックボックスフィールド(たとえば、タイプ能力、雇用者、日付、時間、金額を1つのチェックボックスフィールドとして)に挿入しようとしています。 hmtlページに表示されると、さまざまなチェックボックスを選択して別のページに送信することができます。これまでのところ、私はテーブルを使ってdbの内容を表示することができましたが、チェックボックスにデータを表示するための実用的な解決策を見つけることができませんでしたか?JQuery MobileとPHPを使用してチェックボックスフィールドにデータをエコーする方法はありますか?
大変ありがとうございます! :)これまで
コード: viewsessions.php
<?php
$servername = "localhost";
$username = "root";
$password = "cornwall";
$con=mysqli_connect('localhost','root','cornwall','ibill');
// This code creates a connection to the MySQL database in PHPMyAdmin named 'ibill':
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
// The connection is then checked, if it fails, an echo is sent back to the page stating a connection error.
$viewsessions = "SELECT typeofactivity, employer, date, time, amount FROM session_details";
$result = $con->query($viewsessions);
if ($result->num_rows > 0) {
echo "<table><tr>
<th>Type of Activity</th>
<th>Employer</th>
<th>Date</th>
<th>Time</th>
<th>Amount (GBP)</th>
</tr>";
// output data of each row
while($row = $result->fetch_assoc()) {
echo "<tr>
<td>".$row["typeofactivity"]."</td>
<td>".$row["employer"]."</td>
<td>".$row["date"]."</td>
<td>".$row["time"]."</td>
<td>".$row["amount"]."</td>
</tr>";
}
echo "</table>";
} else {
echo "0 results";
}
$con->close();
?>
私は正確にあなたがabout.Youビューは、各行1のようになるわけ話しているビューを得ることはありませんチェックボックスがチェックされている場合は、能力、雇用者、日付、時間、金額などの値を保持する必要があります。 –
こんにちは@キランムレーリー。基本的には、画面の右側にあるチェックボックスを使用して別のページに送信される個別のセッションをユーザーが選択できるようにしたいと考えています。各セッションは、タイプ能力、雇用主、日付、時間、金額で構成されます。ユーザーは、送信するセッションのボックスをチェックして、選択したセッションを送信します。 – asharoo85