###前提・実現したいこと
ここに質問したいことを詳細に書いてください
PHPとMySQLで作業スケジュール管理システムを作成しています。
入力フォームから作業日、内容は入力、サーチで表一覧形式での表示はできるようになったのですが、
一覧形式の画面から1作業を選択してその内容を更新出来るように考えています。
ここにある"Work order"、"Work date"等は同じ値があるためMySQLのidを使用しPOSTして更新画面で更新出来ないか考えています。
取得データ一覧から1作業をEditボタンで選択し、MySQLから取得したidをhiddenで更新画面edit.phpへPOSTしようとした時以下のエラーメッセージが発生しました。
###発生している問題・エラーメッセージ
Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in /Applications/MAMP/htdocs/disp.php on line 154
###該当のソースコード
// SQL文を実行する
$stm->execute();
// 結果の取得
$result = $stm->fetchAll(PDO::FETCH_ASSOC);
if(count($result)>0){ echo "<h2>Result {$wo}</h2>"; // テーブルのタイトル行 echo "<div class='table-responsive'>","<table class='table table-striped'>"; echo "<thead><tr>"; echo "<th>", "Work order", "</th>"; echo "<th>", "Work date", "</th>"; echo "<th>", "Work time", "</th>"; echo "<th>", "Result", "</th>"; echo "<th>", "", "</th>"; echo "</tr></thead>"; // 値を取り出して行に表示する echo "<tbody>"; foreach ($result as $row){ // 1行ずつテーブルに入れる echo "<tr>"; echo "<td>", ($row['wo']), "</td>"; echo "<td>", ($row['wd']), "</td>"; echo "<td>", ($row['wt']), "</td>"; echo "<td>", ($row['result']), "</td>"; echo "<td>", "<form method='POST' action='edit.php'>", "<input type='hidden' name='id' value='$row['id']'>", "<button type='submit' class='btn btn-primary'>Edit</button>", "</form>", "</td>"; echo "</tr>"; } echo "</tbody>"; echo "</table>","</div>"; } else { echo "<h2>Not Found {$wo}</h2>"; }
}
###試したこと
POSTするためのボタンのvalueが違っているのだとは思うのですが、どうすれば良いのかわからなくなってきました。
回答1件
あなたの回答
tips
プレビュー