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">
<img src="imagenes/bullet.gif"> <a href="search_1024.php" class="menu2">Basic</a>
<br><br>
<img src="imagenes/bullet.gif"> <a href="search_advanced_1024.php" class="menu2">
Advanced<br><br>
</font>
</tr>
<tr>
<td> </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"> Main characteristic
<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:
<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: <input type="text" name="author" size="25">
Year: <input type="text" name="year" size="4">
Month:
<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>
Title: <input type="text" name="title" size="35">
Pages: <input type="text" name="pages" size="10">
Url: <input type="text" name="url" size="35">
<br>
<br>
</td>
</tr>
</table>
CONTENIDO;
}
//AHORA AQUI ME DECLARO LAS FUNCIONES PARA QUE A CONTINUACIÓN
DEL ACTUAL FORMULARIO, ME 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"> Book characteristic <img src="imagenes/dots_transparente.gif"></font></td>
</tr>
<tr>
<td class="resaltar_negro3">
<hr>
Book Title: <input type="text" name="booktitle" size="25">
Editorial: <input type="text" name="editorial" size="25">
Edition: <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">
Journal characteristic
<img src="imagenes/dots_transparente.gif"></font></td>
</tr>
<tr>
<td class="resaltar_negro3">
<hr>
Journal Name: <input type="text" name="booktitle" size="25">
Number: <input type="text" name="number" size="4">
Volume: <input type="text" name="volume" size="4">
Series Name: <input type="text" name="seriesname" size="20">
Editorial: <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"> Conference characteristic <img src="imagenes/dots_transparente.gif"></font></td>
</tr>
<tr>
<td class="resaltar_negro3">
<hr>
Conference Name: <input type="text" name="conferencename" size="25">
Institution: <input type="text" name="institution" size="20">
Place: <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"> Miscellaneous characteristic <img src="imagenes/dots_transparente.gif"></font></td>
</tr>
<tr>
<td class="resaltar_negro3">
<hr>
Publisher: <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