Ver Mensaje Individual
  #5 (permalink)  
Antiguo 28/08/2006, 14:00
Auroch
 
Fecha de Ingreso: agosto-2006
Mensajes: 3
Antigüedad: 17 años, 7 meses
Puntos: 0
El codigo del formulario en mi pagina web es el siguiente:

Código:
<form name="FormName" method="POST" action="../php/busqueda.php">
  <table width="90%" border="0" align="center" cellpadding="1" cellspacing="0" class="TitleColor">
	<tr>
	  <td>
		<table width="100%" border="1" cellspacing="0" cellpadding="4">
		  <tr class="HeaderColor">
			<td colspan="2" class="Subtitulo"> Busqueda</td>
		  </tr>
		  <tr>
			<td style="text-align: right" class="TitleColor">
			  <label for="keywords">Texto: </label></td>
			<td class="TitleColor">
			  <input size="50"  name="textfield">
			</td>
		  </tr>
		  <tr>
			<td height="43" class="TitleColor" style="text-align: right"> Opciones: </td>
			<td class="TitleColor">
			  <table width="100%"  border="0">
				<tr>
				  <td><label for="option1">
					<input type="radio"  name="radiobutton" value="tipob" checked>
					Boletines</label>
				  </td>
				</tr>
				<tr>
				  <td><label for="label">
					<input type="radio"  name="radiobutton" value="tipob">
					Conciertos</label>
				  </td>
				</tr>
				<tr>
				  <td><input type="radio"  name="radiobutton" value="tipob"> 
				  Noticias </td>
				</tr>
				<tr>
				  <td><label for="label2">
					<input type="radio"  name="radiobutton" value="tipob">
					Todos</label>
				  </td>
				</tr>
			  </table>            </td>
		  </tr>
		  <tr>
			<td style="text-align: right" class="TitleColor"><label for="select"> Idioma:</label></td>
			<td class="TitleColor">
			  <select id="select" name="select">
				<option value="idiomab" selected>Castellano</option>
				<option value="idiomab">Euskera</option>
			  </select>
			</td>
		  </tr>
		  <tr>
			<td>&nbsp;</td>
			<td>
			  <input type="submit" name="Submit" value="Buscar";>
			</td>
		  </tr>
	  </table></td>
	</tr>
  </table>
</form>
</div>
<div id="resultado">

</div>
En el ultimo div (resultado) quiero meter el contenido de la busqueda para que aparezca la busqueda.
El codigo de la busqueda es el siguiente:
Código:
<html>
<head>
<title>Busqueda de archivos</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<?php
include '../php/config.php';
include '../php/opendb.php';


	
// how many rows to show per page
$rowsPerPage = 20;

// by default we show first page
$pageNum = 1;

// if $_GET['page'] defined, use it as page number
if(isset($_GET['page']))
{
    $pageNum = $_GET['page'];
}

// counting the offset
$offset = ($pageNum - 1) * $rowsPerPage;

$query1  = "SELECT * FROM documentos LIMIT $offset, $rowsPerPage";

$result = mysql_query($query1) or die('Error, query failed');

	?>
	<TABLE BORDER=1 CELLSPACING=1 CELLPADDING=1>
      <TR><TD>&nbsp;Archivo</TD><TD>&nbsp;Tipo&nbsp;</TD><TD>&nbsp;Idioma</TD></TR>

<?php  
// print the random numbers
while(list($val1,$val2,$val3,$val4,$val5) = mysql_fetch_array($result))
{
    // echo "$val1,$val2,$val3,$val4,$val5 <br>";
	if ($val5=='C')
	{
		$idioma='Castellano';
	}
	else
	{
		$idioma='Euskera';
	}
	switch($val2){
	case "B":

		$tipo='Boletin';
		if ($val5=='E'){
			$tipo='Boletina';}					
		break;
	case "N":
		$tipo='Noticia';
		if ($val5=='E'){
			$tipo='Berria';}					
		break;
	case "C":
		$tipo='Concierto';
		if ($val5=='E'){
			$tipo='Kontzertua';}					
	}
	
	printf("<tr><td>&nbsp;<a href=$val3 target=_blank>%s</a>&nbsp;</td><td>&nbsp;%s&nbsp;</td><td>&nbsp;%s&nbsp;</td></tr>", $val4,$tipo,$idioma);
}

echo '<br>';
?>
</table>
<p>&nbsp;</p>
<?php
// how many rows we have in database
$query2   = "SELECT COUNT(id) AS numrows FROM documentos";
$result  = mysql_query($query2) or die('Error, query failed');
$row     = mysql_fetch_array($result, MYSQL_ASSOC);
$numrows = $row['numrows'];

// how many pages we have when using paging?
$maxPage = ceil($numrows/$rowsPerPage);

$self = $_SERVER['PHP_SELF'];

// creating 'previous' and 'next' link
// plus 'first page' and 'last page' link

// print 'previous' link only if we're not
// on page one
if ($pageNum > 1)
{
    $page = $pageNum - 1;
    $prev = " <a href=\"$self?page=$page\">[Prev]</a> ";
    
    $first = " <a href=\"$self?page=1\">[First Page]</a> ";
} 
else
{
    $prev  = ' [Prev] ';       // we're on page one, don't enable 'previous' link
    $first = ' [First Page] '; // nor 'first page' link
}

// print 'next' link only if we're not
// on the last page
if ($pageNum < $maxPage)
{
    $page = $pageNum + 1;
    $next = " <a href=\"$self?page=$page\">[Next]</a> ";
    
    $last = " <a href=\"$self?page=$maxPage\">[Last Page]</a> ";
} 
else
{
    $next = ' [Next] ';      // we're on the last page, don't enable 'next' link
    $last = ' [Last Page] '; // nor 'last page' link
}

// print the page navigation link
echo $first . $prev . " Showing page <strong>$pageNum</strong> of <strong>$maxPage</strong> pages " . $next . $last;

include '../php/closedb.php';
?>

</body>
</html>
Lo que quiero es que en la pagina web aparezca el formulario de busqueda (aparte del resto de menus,imagenes,etc. de la pagina) con el listado de todos los elementos debajo en el div indicado, y que cuando el usuario haga una busqueda y le de al boton de buscar se recargue la pagina con la nueva condicion para recuperar los datos (todavia no he hecho el where, primero quiero hacer esta parte ;))
Gracias

Última edición por Auroch; 28/08/2006 a las 14:02 Razón: hacer el codigo mas legible