我需要通过此按钮(proyek.php)传递一个值:
<form method="post" action="setidproyek.php">
<button type="submit" class="btn btn-success btn-sm" name="idpro" value="<?php echo $list['id_proyek']; ?>"><i class="fas fa-folder-open"></i> Buka</button>
</form>
此php文件( setidproyek.php ):
<?php
session_start();
$_SESSION('idproyek') = $_POST['idpro'];
header('laporanmingguan.php');
?>
但是我出错了。
答案 0 :(得分:0)
尝试改用此
<form method="post" action="setidproyek.php">
<input type="hidden" name="idpro" value="<?php echo $list['id_proyek']; ?>" />
<button type="submit" class="btn btn-success btn-sm" ><i class="fas fa-folder-open"></i> Buka</button>
<form>