我有这种模式,我想要选择'选择'按下按钮时,我的链接中有$ _POST ['选择']的价值,但它不起作用(链接中没有ID),谢谢。
<!-- Modal -->
<div class="modal fade" id="myModal" role="dialog">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Afficher les factures d'un dossier</h4>
</div>
<div class="modal-body">
<center>
<?php
$bdd = new PDO('mysql:host=MYHOST;dbname=MYDBNAME', 'MYUSERNAME', 'MYPASSWORD');
$dossier = $bdd->query('SELECT * FROM dossiers ORDER BY id DESC');
?>
<p>Choisir un dossier : <form method="POST" action="">
<select name="select"> <?php
while($d = $dossier->fetch())
{
?>
<option value="<?= $d['id'] ?>"><?= $d['id_dossier'] ?></option>
<?php
}
?></select>
</form>
</p>
</center>
</div>
<div class="modal-footer">
<a type="submit" class="btn btn-default" href="displayfolder.ph
p?id=<?= $_POST['select'] ?>">Afficher</a>
</div>
</div>
</div>
</div>
答案 0 :(得分:0)
只是尝试回应像<?php echo $d['id']; ?>
试试这个<a href="displayfolder.php?id=<?php echo $_POST['select']; ?>" ></a>
我建议你使用正确的标签=&gt; <?php ?>
代替使用短标签=&gt; php语法中的<? ?>
。否则,请转到php.ini并检查此行short_tags=on
或不。