
20/10/2004, 10:35
|
 | | | Fecha de Ingreso: octubre-2003 Ubicación: Puerto Montt
Mensajes: 3.667
Antigüedad: 21 años, 4 meses Puntos: 11 | |
con php se puede distinguir que submit se presionó, ejemplo:
formulario.php
<form name="nose" method="post" action="procesa.php">
<input type="text" name="id_cliente">
<input type="text" name="otro_dato_cliente">
<input type="submit" name="agregar" value="Agregar">
<input type="submit" name="modificar" value="Modificar">
<input type="submit" name="borrar" value="Borrar">
</form>
procesa.php
<?php
if(isset($_POST['agregar'])
{
$sql="insert into clientes (id_cliente,otro_dato_cliente) values(".$_POST['id_cliente'].",".$_POST['otro_dato_cliente'].")";
mysql_query($sql,$con);
}
if(isset($_POST['modificar'])
{
$sql="update clientes where set otro_dato_cliente=".$_POST['otro_dato_cliente']." where id_cliente=".$_POST['id_cliente'];
mysql_query($sql,$con);
}
if(isset($_POST['borrar'])
{
$sql="delete from clientes where id_cliente=".$_POST['id_cliente'];
mysql_query($sql,$con);
}
...
?> |