miércoles, 30 de septiembre de 2015

FORMULARIOS EN PHP Y HTML

<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>
        <form action="datos.php" method="POST">
<!--EL NOMBRE DE LA ACTION ES EL OTRO ARCHIVO DE PHP EN DONDE PRESENTARA LOS DATOS-->
            <table border="1">
             
                    <tr>
                        <td>INGRESE SU NOMBRE</td>
                        <td> <input type="text" name="nombre"  /></td>
                    </tr>
                    <tr>
                        <td>INGRESE SU EDAD</td>
                        <td> <input type="text" name="edad" /></td>
                    </tr>
               <tr>
                   <td> </td>
                        <td> <input type="submit" value="ENVIAR" /></td>
                    </tr>
             
            </table>

        </form>
    </body>
</html>
_________________EN ESTE EJEMPLOS TENEMOS EL ARCHIVO UNO DE HTML EL CUAL ES EL FORMULARIO A CAPTURAR LOS VALORES...



______________________________________________________________________________
ESTE ES EL OTRO ARCHIVO DE PHP
EN DONDE PROGRAMAMOS NUESTRAS VARIABLES PARA PRESENTAR NUESTROS RESULTADOS.
<?php
$nombre=$_POST['nombre'];
$edad=$_POST['edad'];

if($edad>=18)
{
    echo $nombre." usted es mayor de edad";
}
else
{
    echo $nombre." usted es menor de edad"; 
}


?>
RECUERDE QUE EL NOMBRE DE LAS VARIABLES DEBERÁN SER IGUALES AL NAME CON QUE LOS IDENTIFICO EN HTML.

_________________________________________________________________________________
ESTO ES PARA TRABAJAR RADIO
<tr>
                        <td>NIVEL DE ESTUDIO</td>
                        <td><label> PRIMARIA</label> <input type="radio" name="estudio" value="primaria"/>
                            <label> SECUNDARIA</label> <input type="radio" name="estudio" value="secundaria"/>
                            <label> DIVERSIFICADO</label> <input type="radio" name="estudio"value="diversificado"/>
                            <label> UNIVERSIDAD</label> <input type="radio" name="estudio" value="universidad"/>
                        </td>
                    </tr>
_________________________________________________________________________________

ESTO ES PARA TRABAJAR CHECKBOX
 <tr>
                        <td>QUE DEPORTES PRACTICA</td>
                        <td><label> FUTBOL</label> <input type="checkbox" name="deportes" value="futbol"/>
                            <label> NATACION</label> <input type="checkbox" name="deportes" value="natacion"/>
                            <label> BASQUTBOLL</label> <input type="checkbox" name="deportes"value="basquetboll"/>
                            <label> MARATON</label> <input type="checkbox" name="deportes" value="maraton"/>
                           
                        </td>
_________________________________________________________________________________
ESTO ES PARA TRABAJAR BOTONES DE SELECCIÒN

<tr>
                        <td>INGRESE SU NOMBRE</td>
                        <td> <input type="text" name="nombre"  /></td>
                    </tr>
                    <tr>
                        <td>SELECCIONE SUELDO</td>
                        <td> <select name="sueldo">
                                <option>2000</option>
                                <option>3000</option>
                                <option>4000</option>
                            </select></td>
                    </tr>
_________________________________________________________________________________
RECUERDE QUE ESTE CASO LAS VARIABLES A UTILIZAR EN PHP POR EJEMPLO SERIA $sueldo.
RECUERDE TENER LOS DOS ARCHIVOS DENTRO DE LA MISMA CARPETA Y EN EL LOCALHOST.

FORMULARIOS EN PHP

PRACTICA 1 – Formulario (controles text y submit)
Confeccionar un formulario que solicite la carga de un nombre de persona y su edad, luego mostrar en
Otra página si es mayor de edad (si la edad es mayor o igual a 18).
PRACTICA 2 – Formulario (control radio)
Solicitar que se ingrese por teclado el nombre de una persona y disponer tres controles de tipo radio
Que nos permitan seleccionar si la persona:
1) no tiene estudios
2) estudios primarios
3) estudios secundarios
En la página que procesa el formulario mostrar el nombre de la persona y un mensaje indicando el tipo
De estudios que posee.
PRACTICA 3 - Formulario (control checkbox)
Confeccionar un formulario que solicite la carga del nombre de una persona y que permita seleccionar
Un deporte que practica (futbol, basket, tennis, voley).etc.
PRACTICA 4– Formulario (control select)
Confeccionar un formulario que solicite el ingreso del nombre de una persona y un combo de selección
(en este último permitir la selección de los ingresos anuales de la persona: DE 2000, 3000, 4000 si la selección es mayor a 3000 me despliegue un mensaje de texto que diga paga ISR.DSYSTEMS 2011