Hola a todos estoy tratando de hacer un insert multiple con este codigo al momento solo me monda un registro aunque tenga dos o mas... espero me puedan ayudar ya que no encuentro mi error
Código PHP:
Ver original<?php
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) { foreach($_POST["clave3"] as $key => $value){
$updateSQL = sprintf("insert into pagos ( .....) values (%s, %s,%s)",
GetSQLValueString($_POST['clave3'][$key], "text"),
GetSQLValueString($_POST['conceptot'][$key], "text"),
GetSQLValueString($_POST['recibi'][$key], "text"));
$insertGoTo = "MensualidadesP.php";
$query_alumnos = sprintf("SELECT * FROM ... ORDER BY id_pago" , GetSQLValueString($colname_alumnos, "text"));
?>
...
<body bgcolor="#ffffff">
<table border="0" cellpadding="0" cellspacing="0" width="1280" align="center">
....
<form action="<?php echo $editFormAction; ?>" method="post" name="form1" id="form1" >
<input type="hidden" name="clave3[]" id="clave3" value="<? echo $row_clientes['cliente']; ?>" size="10" />
<?php
$action = isset($_GET['action']) ?
$_GET['action'] : ""; $alumno = ($_GET['cliente']);
if($action=='removed'){
echo "<div>" . $_GET['name'] . " Eliminado.</div>";
}
if(isset($_SESSION['cart'])){ $ids = "";
foreach($_SESSION['cart'] as $id){
$ids = $ids . $id . ",";
}
require "libs/DbConnect.php";
$query = "SELECT * FROM ... where idcole IN ({$ids})";
$stmt = $con->prepare( $query );
$stmt->execute();
$num = $stmt->rowCount();
if($num>0){
echo "<table border='0' class='pagos'>";
echo "<tr>";
echo "<th class='textAlignLeft'>Mes</th>";
echo "<th></th>";
echo "<th>Monto</th>";
echo "<th>Borrar</th>";
echo "</tr>";
$totalPrice = 0;
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)){
echo "<tr>";
echo "<td><input name='conceptot[]' id='nombre' type='hidden' size='15' value='{$Mes}' />";
echo "</td>";
echo "<td align='left'>Recibi:</td>";
echo "<td><input name='recibi[]' id='recibi' type='text' size='15' value='' />
</td>";
echo "</th>";
echo "</table>";
}else{
echo "<div>No hay mensualidades seleccionadas</div>";
}
}else{
echo "<div>No hay mensualidades</div>";
}
?>
<input type="hidden" name="MM_insert" value="form1" />
</form>