Ver Mensaje Individual
  #7 (permalink)  
Antiguo 03/08/2011, 11:34
thedarking
 
Fecha de Ingreso: julio-2011
Ubicación: Argentina
Mensajes: 38
Antigüedad: 12 años, 9 meses
Puntos: 0
Respuesta: Restriccion con formularios

se podria llevar a correr esa funcion usando un if? if else?, etc???

algo asi no puedo hacer correr??
Código PHP:
<html>
<
body>
<
br><center>Formulario(Env&iacute;o de MP)</center></br>
<
form action="insertar-registro.php" method="POST">
            
            
Mensaje:<textarea name="mensaje" cols="30" rows="3"></textarea><p>
            
            
Selecci&oacute;n:    <input name="col" type="radio" value="si"/>    si                &nbsp;&nbsp;
                                <
input name="col" type="radio" value="no" checked/>    no        &nbsp;&nbsp;
                                <
input name="col" type="radio" value="nose"/>    nose        &nbsp;&nbsp;<p>
            
            
Opci&oacute;n:        <input type="checkbox" name="opc" value="ok"/>OK</input>&nbsp;&nbsp;
                                <
input type="checkbox" name="opc" value="nada" checked/>Nada</input>&nbsp;&nbsp;<p>
            
            
Tel&eacute;fono:    <input type="text" name="telefono">Acu&eacute;rdate de usar solo n&uacute;meros<p>
            
            
E-Mail:                <input type="text" name="email"><p>
<
input name="enviar" type="submit" value="enviar">
<
input type="reset" name="limpiar">
</
form>
</
body>
</
html
Código PHP:
<?php
include"conexion.php";
$telefono $_POST['telefono'];
$email $_POST['email'];
$col $_POST['col'];
$opc $_POST['opc'];

if (
$telefono="" or $email="") {

    echo
"Los campos: telefono y email, no pueden estar vacios";
}

mysql_query("insert into clientesl2(mensaje,seleccion, opcion, telefono, email) values ('{$_REQUEST['mensaje']}','$col','$opc','{$_REQUEST['telefono']}','{$_REQUEST['email']}')") or die("no anda el el insert" .mysql_error());
?>

<html>
    <body>
        <b><hl><center>
            <p>&nbsp;</p>
            <p>&nbsp;</p>
            <p>&nbsp;</p>
            <p>&nbsp;</p>
            <p>&nbsp;</p>
          <a href="index.html"><button>indice</button></a>
        </center></hl></b><br>
    </body>
</html>

Última edición por thedarking; 03/08/2011 a las 12:04