How can I implement or replace my traditional alert when saving a record, by sweet alert.
My form in html is as follows:
<h2>Agregar registro</h2>
<form action='procesar.php' method='post'>
Nro. Interno:
<input name="nro_inve" id="nro_inve" type="text">
<br>
Serial:
<input name="serial_inve" id="serial_inve" type="text">
<br>
Marca:
<select name="marca_inve">
<option value="BRIDGESTONE">BRIDGESTONE</option>
<option value="MICHELIN">MICHELIN</option>
<option value="GOODYEAR">GOODYEAR</option>
</select>
<br>
Tamaño:
<input name="dimen_inve" id="serial_inve" type="text">
<br>
Diseño:
<input name="tipo_inve" id="serial_inve" type="text">
<br>
<input type="submit" name="submitcsv" value="GUARDAR"/>
</form>
And then when I press the SAVE button, it will process.php and if everything is correct, depending on the condition, it shows me the message in an alert.
require("conexion.php");
$conexion=conectar();
/* AQUÍ RECIBO LAS VARIABLES*/
$nro_inve=$_POST['nro_inve'];
$serial_inve=$_POST['serial_inve'];
$marca_inve=$_POST['marca_inve'];
$dimen_inve=$_POST['dimen_inve'];
$tipo_inve=$_POST['tipo_inve'];
$sql="insert into inventario(nro_inve,serial_inve,marca_inve,dimen_inve,tipo_inve)
values('$nro_inve','$serial_inve','$marca_inve','$dimen_inve','$tipo_inve')";
/* Y LUEGO ALLI ABAJO ESTAN LOS ALERT DEPENDIENDO DE LA CONDICIÓN ME MUESTRA
UN ALERT POSITIVO O NEGATIVO, ESTOS ALERT QUISIERA CAMBIARLOS POR SWEET ALERT
PARA QUE SE VEAN MÁS GRANDES Y MUCHO MEJOR */
$ok=mysql_query($sql,$conexion);
if ($ok)
{
echo"<script type='text/javascript'>
alert('El registro se realizo correctamente');
window.location='balance.php';
</script>";
}
else
{
echo "<script>alert('Error! intentalo nuevamente')
window.location='balance.php';</script>";
}
How can I change those alerts to sweet alerts so that they can be seen larger and much better.
Many thanks.
Greetings.
You need to download the library to use the sweetalert to your project and import it in your page... or put this:
and where you have an alert replace it like this:
and you will have something like this: