Ver Mensaje Individual
  #9 (permalink)  
Antiguo 20/05/2009, 16:59
dijor69
 
Fecha de Ingreso: marzo-2007
Mensajes: 42
Antigüedad: 17 años, 1 mes
Puntos: 0
Respuesta: Ayuda con expediente x en php(almenos para mi)

Este seria el formulario

Código:
<?
//###variables###
$dia= date("j");
$mes= date("m");
$ano= date("Y");
?>


<div class='post'>

					<h3>Formulario de Contacto o Reservas</h3><br><br>
					<?//###errores de formulario##
							if(isset($_GET['error'])){
														 $error=$_GET['error'];
														if($error==1) {echo "<font size='2' color='red'>Debe introducir su nombre y apellidos</font>";}
														if($error==2) {echo "<font size='2' color='red'>Debe introducir su telefono o email para que nos pongamos en contacto con usted</font>";}
														
																}

					?>
					<div class='contentarea'>
					<div align='right'>*Campos requeridos</div>
					<form name='form1' method='post' action='adminmod/enviar.php'>

     					   <table width='100%' border='0' cellspacing='4' cellpadding='0'>

    						<tr> <td>Indique si quirere contactar o reservar:<br></td>

                        <td width='63%' align='left'><font size='2'><input type='radio' name='tipocontacto' value='0' checked>   Contacto   <input type='radio' name='tipocontacto' value='1'>    Reserva    </td>

          </tr>      
						<tr> 

          						  <td width='37%'><font size='2'>Nombre y Apellidos*:</font></td>

     							       <td width='63%'>

     							         <input type='text' name='nombre' size='30'>

         					     </td>

    						      </tr>

  						        <tr> 

  					          <td width='37%'><font size='2'>Direcci&oacute;n:</font></td>

   					         <td width='63%'><font size='2'>

   					           <input type='text' name='Direccion' size='30'>

					              </font></td>

					          </tr>

  					        <tr> 

					            <td width='37%'><font size='2'>Localidad:</font></td>

 					           <td width='63%'><font size='2'>

 					             <input type='text' name='Localidad' size='30'>

				              </font></td>

					          </tr>

					          <tr> 

						            <td width='37%'><font size='2'>Provincia:</font></td>

						            <td width='63%'><font size='2'>

					              <input type='text' name='Provincia' size='30'>

 					             </font></td>

 					         </tr>

  					        <tr> 

     							       <td width='37%'><font size='2'>CP:</font></td>

     							       <td width='63%'><font size='2'>

      							        <input type='text' name='CP' size='10'>

    							          </font></td>

    					      </tr>

						 <tr> 

						  		          <td width='37%'><font size='2'>Tel&eacute;fono:</font></td>

 								           <td width='63%'>

								              <input type='text' name='Telefono' size='15'>

 								             </td>

 					         </tr>

  					          <tr> 

						            <td width='37%'><font size='2'>E-mail:</font></td>

    						        <td width='63%'><font size='2'>

     					         <input type='text' name='Email' size='30'>

    					          </td>

     					     </tr>
			<tr> 

            <td width='37%' align='left'><font size='2' >Por favor, contacten conmigo a trav&eacute;s 

              de:</font></td>

            <td width='63%' align='left'><font size='2'><input type='radio' name='formacontacto' value='Email' checked>  E-mail  <input type='radio' name='formacontacto' value='telefono' >  Telefono  <br>(Por favor, indique el telefono o email para contactar) </td>

          </tr>

  					        <tr> 

            <td width='37%'><font size='2'>Fecha de llegada:</font></td>

            <td width='63%'><font size='2'> 

              <select name='Fechadiallegada'>

                <option value='01' <? if($dia==1) {echo "selected";} ?> >1</option>

                <option value='02' <? if($dia==2) {echo "selected";} ?> >2</option>

                .....
              </select>  

              <select name='Fechamesllegada'>

                <option value='01' <? if($mes==01) {echo "selected";} ?> >Enero</option>

                <option value='02' <? if($mes==02) {echo "selected";} ?> >Febrero</option>

                <option value='03' <? if($mes==03) {echo "selected";} ?> >Marzo</option>

                <option value='04' <? if($mes==04) {echo "selected";} ?> >Abril</option>

                <option value='05' <? if($mes==05) {echo "selected";} ?> >Mayo</option>

                <option value='06' <? if($mes==06) {echo "selected";} ?> >Junio</option>

                <option value='07' <? if($mes==07) {echo "selected";} ?> >Julio</option>

                <option value='08' <? if($mes==08) {echo "selected";} ?> >Agosto</option>

                <option value='09' <? if($mes==09) {echo "selected";} ?> >Septiembre</option>

                <option value='10' <? if($mes==10) {echo "selected";} ?> >Octubre</option>

                <option value='11' <? if($mes==11) {echo "selected";} ?> >Noviembre</option>

                <option value='12' <? if($mes==12) {echo "selected";} ?> >Diciembre</option>

              </select>

              <select name='Fechaanollegada'>

		<option value=' <? echo $ano;?> ' selected><font size='2'><? echo $ano;?></font></option>
		<option value=' <? echo $ano+1;?> '><font size='2'><? echo $ano+1;?></font></option>

              </select>

              </font></td>

          </tr>

          <tr> 

            <td width='37%'><font size='2'>Fecha de salida:</font></td>

            <td width='63%'><font size='2'> 

              <select name='Fechadiasalida'>

               <option value='01' <? if($dia==1) {echo "selected";} ?> >1</option>

                <option value='02' <? if($dia==2) {echo "selected";} ?> >2</option>

                <option value='03' <? if($dia==3) {echo "selected";} ?> >3</option>

               ....

              </select>

              <select name='Fechamessalida'>

                <option value='01' <? if($mes==01) {echo "selected";} ?> >Enero</option>

                <option value='02' <? if($mes==02) {echo "selected";} ?> >Febrero</option>

                <option value='03' <? if($mes==03) {echo "selected";} ?> >Marzo</option>

                <option value='04' <? if($mes==04) {echo "selected";} ?> >Abril</option>

                <option value='05' <? if($mes==05) {echo "selected";} ?> >Mayo</option>

                <option value='06' <? if($mes==06) {echo "selected";} ?> >Junio</option>

                <option value='07' <? if($mes==07) {echo "selected";} ?> >Julio</option>

                <option value='08' <? if($mes==08) {echo "selected";} ?> >Agosto</option>

                <option value='09' <? if($mes==09) {echo "selected";} ?> >Septiembre</option>

                <option value='10' <? if($mes==10) {echo "selected";} ?> >Octubre</option>

                <option value='11' <? if($mes==11) {echo "selected";} ?> >Noviembre</option>

                <option value='12' <? if($mes==12) {echo "selected";} ?> >Diciembre</option>

              </select>

              <select name='Fechaanosalida'>

		<option value= ' <? echo  $ano ;?> ' selected><font size='2'><? echo $ano;?></font></option>
		<option value=' <? echo $ano+1;?> '><font size='2'><? echo $ano+1;?></font></option>

              </select>

              </font></td>

          </tr>

          <tr> 

            <td width='37%'><font size='2'>Numero de personas:</font></td>

            <td width='63%'><font size='2'>

              <input type='text' name='NumeroDePersonas' size='5'>

              </font></td>

          </tr>

    

          <tr> 

            <td width='37%'><font size='2'>Solicitud de contacto o informacion sobre reserva:</font></td>

            <td width='63%'><font size='2'>

		   <textarea rows='10' name='otrosdatos' cols='38'></textarea></td>

              </font></td>

          </tr>

          

        </table>

        <div align='right'><br>

          <input type='submit' name='Submit' value='Enviar'>

          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </div>

      </form></div></div>
Este seria el que recibe:
Código:
<? //### Abre la base de datos ###




//Comprobacion de los datos--------------------------
if($_POST["nombre"]==null ){ header("Location:../index.php?page=6&error=1");}
if($_POST["Email"]==null && $_POST["telefono"]==null){ header("Location:../index.php?page=6&error=2");}






else {

 
header("Location:../index.php");
}

?>