這是我的代碼和PHP的Header()函數不能幫助我,有人可以幫我找到我的錯誤或其他解決方案嗎? 執行後,這個查詢「DELETE FROM PAGOS其中id = $ id爲」不回我tabla_pagos.php如何執行php中的表單後返回上一頁php
<?php
include "app/conexionqa.php";
require("templates/menu.php");
$id=$_GET["parametro"];
$data = $conn -> query("SELECT * FROM pagos where id=$id");
if(isset($_POST['eliminar'])){
$idAdmin=$_POST["idAdmin"];
$fPago=$_POST["fPago"];
$status=$_POST["status"];
$montoPagar=$_POST["montoPagar"];
$sql= $conn -> query("DELETE FROM pagos where id=$id");
header("Location: tabla_pagos.php");
}?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<br>
<br>
<section class="header__user">
<!--<div id="edit" class="modal">-->
<div class="modal-content">
<h3 class="center unbutu loginTitle blue-text">Eliminar registro</h3>
<?php foreach($data as $campo){?>
<form action="#" method="post">
<label>Id</label>
<p><?php echo $id; ?></p>
<label>Invitado por:</label>
<input type="text" name="idAdmin" value="<?php echo $campo['idAdmin']; ?>"/>
<label>Fecha de pago</label>
<input type="text" name="fPago" value="<?php echo $campo['fPago']; ?>"/>
<label>Status</label>
<input type="text" name="status" value="<?php echo $campo['status']; ?>"/>
<label>Cantidad ultimo pago</label>
<input type="text" name="montoPagar" value="<?php echo $campo['montoPagar']; ?>"/>
<button class="btn waves-effect waves-light" type="submit" name="eliminar">Eliminar
</button>
<a href="tabla_pagos.php"> Cancelar</a>
</form>
<?php } ?>
</div>
</div>
</section>
</body>
</html>
<?php require("templates/footer.php");
?>
From manual「請記住,在發送任何實際輸出之前,必須調用header(),或者通過普通的HTML標籤,文件中的空行或PHP。」所以......包含文件中包含什麼內容? http://php.net/manual/en/function.header.php – Andreas
那麼會發生什麼? – TimBrownlaw
嗨安德烈亞斯!在我的包含文件中,我只有連接到數據庫 –