Ver Mensaje Individual
  #1 (permalink)  
Antiguo 14/09/2012, 15:29
francocsanchez
 
Fecha de Ingreso: abril-2012
Ubicación: Mendoza
Mensajes: 43
Antigüedad: 12 años
Puntos: 2
Pregunta Alerta en PHP

Buenos dias gente, estoy haciendo una simple carga de registros en una base de datos, estoy utilizando la siguiente clase

Código:
<?php
class Productos{
 public function GrabarProductos(){
  $query = "INSERT INTO mediospagos VALUES ('','".$_POST['nombre']."','".$_POST['descripcion']."')";
      $result = mysql_query($query);
      if (!$result){
	 echo "Error al Grabar Producto ";
 }else{
          echo "Producto Grabado";
 }
 }
}
?>
Los datos los carga excelente pero ahora mi pregunta y perdon por mi ignorancia, pero quiero que el cartel de "Error al grabar Producto " o "Producto Grabado" me salga debajo de mi formulario, no por encima. Como hago ?

Este es el codigo de mi formulario

Código:
<?php
include_once("../../Config/conexion.php");   //Incluyo mi archivo de Conexion
include_once("../../Model/Productos.php");     // Incluyo mi archivo donde tengo mi clase Productos
$link = new Conexion("localhost","root","","directv");     // llamo a mi clase Conexion y le envio los parametros 
$cliente = new Productos();     //llamo ami clase Clientes para luego llamar a mi metodo GrabarClientes
if(isset($_GET['action'])){   //Pregunto si he realizado una llamada por get 
 if($_GET['action']=="grabar"){ 
    $cliente->GrabarProductos();   // llamo a mi metodo que esta en mi clase
 } 
}
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento sin título</title>
<?php include("../../Includes/hojas.php") ?>
</head>

<body>
<div class="container">

<h2><i>DATOS DE LA FORMA DE PAGO</i></h2>
<br />
  <form action="add.php?action=grabar"" method="post" name="form1" class="well">
    <table align="center">
      <tr valign="baseline">
        <td nowrap="nowrap" align="right">NOMBRE (*) :</td>
        <td><input type="text" name="nombre" value="" size="32" id="nombre" /></td>
      </tr>
      <tr valign="baseline">
        <td nowrap="nowrap" align="right" valign="top">DESCRIPCION :</td>
        <td><textarea name="descripcion" cols="50" rows="5" id="descripcion"></textarea></td>
      </tr>
      <tr valign="baseline">
        <td nowrap="nowrap" align="right">&nbsp;</td>
        <td><input name="submit" type="submit" class="btn btn-info"  value="NUEVA FORMA DE PAGO"/></td>
      </tr>
    </table>
  </form>
  <p>&nbsp;</p>
<div class="alert alert-info">
		<strong>(*)</strong> Campos obligatorios !</a>
	</div>
<! --- ACA NECESITO LA ALERTA ! >
</div>
</body>
</html>
Muchas gracias.
Saludos a todos