Ver Mensaje Individual
  #9 (permalink)  
Antiguo 05/12/2004, 06:09
aimar_20
 
Fecha de Ingreso: junio-2004
Mensajes: 101
Antigüedad: 19 años, 11 meses
Puntos: 0
siento no explicarme mejor

Hola, siento no explicarme mejor. No soy muy entendido en esto de los formularios.

Tengo 2 páginas, una en la que se muestra el formulario, y otra en la que se muestran los resultados.

Aqui te pongo la del formulario (search_1024.php)

Código PHP:
<?
include("./lib_design_1024.php");
include_once(
"./lib_bd.php");
ini_HTML();
titulo();
menu();

function 
contenido() {
echo <<<CONTENIDO
<table class="tabla_980" align="center" cellpadding="0" cellspacing="0">
        
    <tr>

      <!--Primera columna--> 
      <td width="15%" rowspan="3" valign="top" bgcolor="#3A8BCB"><br>
        <table width="100%" cellspacing="0" cellpadding="0">
          <tr>
            <td><img src="imagenes/SPACER.GIF" class="spacer"></td>
          </tr>
          <tr>
<font class="menu_izq">
 &nbsp;&nbsp;
<img src="imagenes/bullet.gif">&nbsp;&nbsp;<a href="search_1024.php" class="menu2">Basic</a>
<br><br> &nbsp;&nbsp;
<img src="imagenes/bullet.gif">&nbsp;&nbsp;<a href="search_advanced_1024.php" class="menu2">
Advanced<br><br>
           </font>
          </tr>
          <tr>
            <td>&nbsp;</td>
          </tr>
        </table>
      </td>
        

      <!--Segunda columna-->         
      <td width="85%">
    
       <table width="95%" align="center" border="0" cellpadding="3" cellspacing="1" >
    
    <tr></tr><tr></tr>
        <tr> 
         <td bgcolor="E3EDFF">
          <form metod="post" action="resultados_1024.php">
<table width="100%" cellpadding="2" cellspacing="0" align="center" >
                
                <tr>
     <td bgcolor="CCCCFF"><font class="resaltar_azul2">

<img src="imagenes/dots_transparente.gif">&nbsp;Main characteristic &nbsp;

<img src="imagenes/dots_transparente.gif"></font></td>
                </tr>
                <tr>
                  <td class="resaltar_negro3">
                  <hr>

 //ESTE ES LA LISTA QUE QUIERO QUE ME CAPTURE EL VALOR
    Type: &nbsp;
    <select name="type" size=1 onchange="this.form.submit()">
      <option>--------------------</option>
    <option value="book">Book</option>
     <option value="journal">Journal</option>
       <option value="conference">Conference</option>
       <option value="miscellaneous">Miscellaneous</option>
                   </select>

 Author: &nbsp;<input type="text" name="author" size="25">

Year: &nbsp;&nbsp;<input type="text" name="year" size="4">

     Month: &nbsp;
       <select name="month" size=1>
       <option>--------------------</option>
      <option>January</option>
       <option>February</option>
       <option>March</option>
      <option>April</option>
       <option>Maig</option>
       <option>June</option>
       <option>Julay</option>
       <option>August</option>
      <option>Setemnber</option>
       <option>October</option>
       <option>November</option>
       <option>December</option>
       </select>
                  <br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Title: &nbsp;<input type="text" name="title" size="35">

Pages: &nbsp;<input type="text" name="pages" size="10">

 Url: &nbsp;<input type="text" name="url" size="35">&nbsp;&nbsp;
                   <br>

                 
                 
                   <br>
                  
                   </td>
            </tr>
        
          </table>
          
CONTENIDO;
}
//AHORA AQUI ME DECLARO LAS FUNCIONES PARA QUE A CONTINUACIÓN 
DEL ACTUAL FORMULARIOME AÑADA LOS CAMPOS ESPECIFICOS DE CADA TIPO

function book() {
echo <<<BOOK
 <table width="100%" cellpadding="2" cellspacing="0" align="center" >

<tr>
    <td bgcolor="CCCCFF"><font class="resaltar_azul2"><img src="imagenes/dots_transparente.gif">&nbsp;Book characteristic &nbsp;<img src="imagenes/dots_transparente.gif"></font></td>
</tr>
<tr>
        <td class="resaltar_negro3">
                  <hr>        
Book Title: &nbsp;<input type="text" name="booktitle" size="25">

Editorial: &nbsp;&nbsp;<input type="text" name="editorial" size="25">

Edition: &nbsp;&nbsp;<input type="text" name="edition" size="4">
                

               </td>
            </tr>
        
          </table>
BOOK;
}  
    
function 
journal() {
echo <<<JOURNAL
 <table width="100%" cellpadding="2" cellspacing="0" align="center" >

<tr>
<td bgcolor="CCCCFF"><font class="resaltar_azul2"><img src="imagenes/dots_transparente.gif">
&nbsp;Journal characteristic &nbsp;
<img src="imagenes/dots_transparente.gif"></font></td>
</tr>
<tr>

<td class="resaltar_negro3">
 <hr>        
Journal Name: &nbsp;<input type="text" name="booktitle" size="25">

Number: &nbsp;&nbsp;<input type="text" name="number" size="4">

Volume: &nbsp;&nbsp;<input type="text" name="volume" size="4">
                
Series Name: &nbsp;&nbsp;<input type="text" name="seriesname" size="20">

Editorial: &nbsp;&nbsp;<input type="text" name="seriesname" size="25">
               </td>
            </tr>
        
          </table>
JOURNAL;
}  

function 
conference() {
echo <<<CONFERENCE
 <table width="100%" cellpadding="2" cellspacing="0" align="center" >

<tr>
    <td bgcolor="CCCCFF"><font class="resaltar_azul2"><img src="imagenes/dots_transparente.gif">&nbsp;Conference characteristic &nbsp;<img src="imagenes/dots_transparente.gif"></font></td>
</tr>
<tr>
<td class="resaltar_negro3">
 <hr>        
Conference Name: &nbsp;<input type="text" name="conferencename" size="25">

Institution: &nbsp;&nbsp;<input type="text" name="institution" size="20">

Place: &nbsp;&nbsp;<input type="text" name="place" size="20">
                
               </td>
            </tr>
        
          </table>
CONFERENCE;
}  

function 
miscellaneous() {
echo <<<MISCELLANEOUS
 <table width="100%" cellpadding="2" cellspacing="0" align="center" >

<tr>
    <td bgcolor="CCCCFF"><font class="resaltar_azul2"><img src="imagenes/dots_transparente.gif">&nbsp;Miscellaneous characteristic &nbsp;<img src="imagenes/dots_transparente.gif"></font></td>
</tr>
<tr>
        <td class="resaltar_negro3">
                  <hr>        
Publisher: &nbsp;<input type="text" name="publisher" size="25">


               </td>
            </tr>
        
          </table>
MISCELLANEOUS;
}  

//AHORA, EN ESTA FUNCION, con un switch intento recoger el valor de type, y en funcion, de la variable type, me ponga un contenido u otro, pero como el form lo tengo para que cuando le de a enviar, me vaya a la pagina de resultados, entonces me dice que no he rellenado los datos. De ahi mi dudua de si es posible hacer esto mismo que hago en php, hacerlo con javascript, ya que con php veo que no se puede.

function contenido2(){

/*$type=$_POST['type'];
switch($type) {
case "book" : book();break;
case "journal" : journal();break;
case "conference" : conference(); break;
case "miscellaneous" : miscellaneous(); break;
}*/
echo<<<CONTENIDO2
     
          </td>
      </tr>
    </table> <br>
    <center><input class="button" name="buscar" type="submit" Value="Search"></center>
    </form>
    <font class="text">
CONTENIDO2;

}

function 
cerrar_contenido() {
echo<<<CERRARCONTENIDO
<br><br><br><br><br><br><br><br>
<br><br><br><br>


  </td>
  
 </tr>

CERRARCONTENIDO;

}

contenido();
contenido2();
cerrar_contenido();



pie();
fin_HTML();
?>

En el siguiente mensaje te expongo la página de resultaods

Última edición por tunait; 06/12/2004 a las 07:16