Este formulario se imprime las cantidades de veces según los resultados, pero ajax solo me atrapa el primer formulario, los demas formularios me los envia saltando a la otra pagina. Aqui mi codigo en Ajax. :)
<script language="javascript">// <![CDATA[
$(document).ready(function() {
$().ajaxStart(function() {
$('#loading').show();
$('#result').hide();
}).ajaxStop(function() {
$('#loading').hide();
$('#result').fadeIn('slow');
$("#result").fadeOut(1000);
});
$('#h').submit(function() {
$.ajax({
type: 'POST',
url: "ercc.php",
data: $(this).serialize(),
success: function(data) {
$('#result').html(data);
}
})
return false;
});
})
// ]]></script>
<?php $result = mysql_query("SELECT * FROM hclinico WHERE id = '$id' ");?>
<?php while($row = mysql_fetch_array($result)){?>
<form id="h" name="h" method="post" autocomplete="off" action="ercc.php">
<table id="m" width="30%" height="311" border="0">
<tr>
<td width="2%"> </td>
<td width="46%"> </td>
<td width="2%"> </td>
<td width="36%"> </td>
<?php echo "<td><a href='ppdf2.php?idd=".$row['idd']."' target='_blank'> <img src='print.png' width='20' height='20' /> </a></td>"; ?>
<!--<td width="14%"><img src="print.png" width="20" height="20" /></td>-->
</tr>
<tr>
<td> </td>
<?php echo "<td><input type='hidden' name='idd[]' value='".$row['idd']."' /></td>";?>
<td><div id="result"></div></td>
<td>Sintomas</td>
<td> </td>
</tr>
<tr>
<td> </td>
<td><table width="20" border="0">
<tr><td>Cédula</td>
<td><input name="id[]" type="text" value=" <?php echo $row['id'] ?> " readonly/>
<label for="cédula"></label></td>
</tr>
<tr>
<td>Talla</td>
<td><label for="talla"></label>
<input type="text" name="talla[]" value=" <?php echo $row['talla'] ?> " required /></td>
</tr>
<tr>
<td>F.C.</td>
<td><label for="F.C."></label>
<input type="text" name="fc[]" value=" <?php echo $row['fc'] ?> " required /></td>
</tr>
<tr>
<td>Fecha</td>
<td><label for="fecha"></label>
<?php echo " <input type='date' name='fecha[]' value='".$row['fecha']."' required/>";?>
</td>
</tr>
<tr>
<td>Hora</td>
<td><label for="hora"></label>
<input type="text" name="hora[]" value=" <?php echo $row['hora'] ?> " required /></td>
</tr>
<tr>
<td>P.A.</td>
<td><label for="pa"></label>
<input type="text" name="pa[]" value=" <?php echo $row['pa'] ?> " required /></td>
</tr>
<tr>
<td>F.R.</td>
<td><label for="fr"></label>
<input type="text" name="fr[]" value=" <?php echo $row['fr'] ?> " required /></td>
</tr>
<tr>
<td>Peso</td>
<td><label for="peso"></label>
<input type="text" name="peso[]" value=" <?php echo $row['peso'] ?> " required /></td>
</tr>
</table></td>
<td> </td>
<?php $sint=$row['sint']; ?>
<td><textarea name="textfield" cols="30" rows="12" name="sint[]" type="text" value=" <?php $sint ?> " ><?php echo $sint; ?></textarea></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td><input type="submit" name="mysubmit" value="Actualizar" /></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
<br />
<label for="textfield3"></label>
</form>
<?php }