Php 如何在mysql中将表单POST值添加为数组?
我想将$_POST['memo']这是一个从$ids到我的数据库的数组。这是一个脚本发送付款给贝宝 pre_checkout.phpPhp 如何在mysql中将表单POST值添加为数组?,php,mysql,arrays,Php,Mysql,Arrays,我想将$_POST['memo']这是一个从$ids到我的数据库的数组。这是一个脚本发送付款给贝宝 pre_checkout.php <table class="table"> <thead> <tr> <th>Titre</th> <th>Coût</th> <t
<table class="table">
<thead>
<tr>
<th>Titre</th>
<th>Coût</th>
<th>Quantité choisie</th>
</tr>
</thead>
<tbody class="table">
<?php $total_price = 0;
$retour = mysql_query('SELECT * FROM billets_vendus WHERE eventid="'.$_GET['id'].'" ORDER BY id DESC');
while ($donnees = mysql_fetch_array($retour)) // On fait une boucle pour lister les news.
{
?>
<tr>
<?php
// lancement de la requete
$sql = 'SELECT * FROM event_tickets WHERE id = "'.$donnees['id_ticket'].'"';
// on lance la requête (mysql_query) et on impose un message d'erreur si la requête ne se passe pas bien (or die)
$req = mysql_query($sql) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
// on recupere le resultat sous forme d'un tableau
$data = mysql_fetch_array($req);
$ids[] = $data['id'];
?>
<td><?php echo stripslashes($data['titre']); ?></td>
<td>$ <?php echo stripslashes($donnees['amount']); ?></td>
<td> <?php echo stripslashes($donnees['qty']); ?></td>
</tr>
<?php
$total_price += $donnees['amount'] * $donnees['qty'];
} // Fin de la boucle qui liste les news.
?>
</table>
<h1>Total : $ <?php echo $total_price;?></h1>
<form method="post" action="buy/Buy.php" class="commentsForm">
<div class="input-group">
<input type="hidden" name="amount" id="inp_tw23" value="<?php echo $total_price;?>" class="form-control" >
<input type="hidden" name="itemname" id="inp_tw20" value="<?php echo $ids;?>" class="form-control" >
<input type="hidden" name="business" value="<?php echo $_POST['business'];?>">
<input type="hidden" name="business2" value="paiement@gaspesia.co">
<input type="hidden" name="ticketid" value="<?php echo $id_ticket;?>">
<span class="input-group-btn"><input type="submit" value="Procéder au paiement" class="btn btn-green"></span>
</div>
</form>
谢谢大家!!如果您能帮助我,我将不胜感激。如果您能,您应该这样做。它们不再得到维护,而是在使用。学习替代,并考虑使用PDO。在您的窗体中,我看不到引用“代码> name =“备忘录”< /C> >也不>代码> ID=“备忘录”< /代码>。哪里定义了
$\u POST['memo']
?memo=itemname。Paypal从itemname创建值
$ids=$_POST['memo'];
foreach($ids as $id => $where){
mysql_query("UPDATE billets_vendus SET status_payment='1' WHERE id_ticket = '$where'") or die(mysql_error());
}