Ver Mensaje Individual
  #3 (permalink)  
Antiguo 08/04/2009, 13:13
Avatar de miros84
miros84
 
Fecha de Ingreso: diciembre-2008
Mensajes: 351
Antigüedad: 15 años, 4 meses
Puntos: 4
Respuesta: Pregunta de if else

Código PHP:
<?php 
ini_set
('error_reporting'E_ALL);
$self=$_SERVER['PHP_SELF'];
$con mysql_connect("456","web","dfgdfgdfg");
if (!
$con)
  {
  die(
'Could not connect: ' mysql_error());
  }

mysql_select_db("mitabla"$con);


if(isset(
$_POST["ime"])) {$ime=addslashes(trim($_POST["ime"]));}
if(isset(
$_POST["mail"])) {$mail=addslashes(trim($_POST["mail"]));}
if(isset(
$_POST["mensaje"])) {$mensaje=addslashes(trim($_POST["mensaje"]));}
if(isset(
$_POST["spam"])) {$spam=addslashes(trim($_POST["spam"]));}


if(
$ime!="" and $mail!="" and $mensaje!="")

if(
$spam==78){ 
mysql_query("INSERT INTO formulario (ime, mail, mensaje)
VALUES ('$ime', '$mail', '$mensaje')"
); 



$result mysql_query("SELECT * FROM formulario");
while(
$row mysql_fetch_array($result))
{
aqui va el texto de la tabla
}
?>

Echa un vistazo si tengo la suficiente seguridad.
La linea if($spam==78){} es porque tengo in input con antispam pregunta, donde si respondes con 78 se inserta, si no, no se inserta nada. Donde meteria el codigo que tu me proporcionaste?