Проблема: не срабатывает файл update.php при нажатии на кнопку Редактировать
<form action="" method="POST">
<input type="submit" name ="orders" value="Распоряжения"><br/><br/>
<center>
<?php
if(isset($_POST['orders'])){
$rezQuery = $dbh->query('SELECT * FROM orders');
echo '<table border ="1" border-collapse: collapse>';
while ($row = $rezQuery -> fetch()) {
echo '<tr><td>'.$row['date'].'</td><td>'.$row['time'].'</td><td>'.$row['responsible'].'</td><td>'.$row['text'].'</td><td>'.$row['changes'].'</td><td><form action="update.php" method="post"><input type="hidden" name="edit" value="'.$row['id'].'"><input type="submit" value ="Редактировать" ></form></td><td><form method="POST"><input type="hidden" name="del" value="'.$row['id'].'"><input type="submit" value ="Удалить" ></form></td></tr>';}
echo '</table>';
}
if (isset($_POST['del']) ) {
$del = intval($_POST['del']);
$stmt = $dbh->prepare("DELETE FROM orders WHERE id= '$del'");
$stmt->execute();
}
if (isset($_POST['edit']) ) {
$edit = intval($_POST['edit']);
$stmt = $dbh->prepare("UPDATE FROM orders WHERE id= '$edit'");
$stmt->execute();
}
?>
</center>
</form>
Содержимое файла update.php
<form action="update.php" method="post">
<label>Дата</label><br/>
<input name="date" type="date" value= <?php echo $rezin[0]['date']?>><br/><br/>
<label>Время</label><br/>
<input name="time" type="time" value= <?php echo $rezin[0]['time']?>><br/><br/>
<label>Ответственный</label><br/>
<input name="responsible" type="text" value= <?php echo $rezin[0]['responsible']?>><br/><br/>
<label>Описание</label><br/>
<input name="text" type="text" value= <?php echo $rezin[0]['text']?>><br/><br/>
<label>Дата и время последнего изменения</label><br/>
<input name="changes" type="datetime" value= <?php echo $rezin[0]['changes']?>><br/><br/>
<input type="submit" value="Редактировать"><br/><br/>
</form>
|