El formulario se encuentra cargado en un bd index.php va tomando otros scripts que toman de la bd el form y lo imprimen.
Cuando le doy submit al form, este llama a serch php que se ejecuta a traves del index.php. EL problema es que no toma las varibles del formulario, como si no las hubiera mandado, esto solo me sucede cuando lo subo al servidor, desde localhost en mi maquina no hay problemas.
Aqui les dejo los scrips.
inde.pxp
Código PHP:
if($_GET['action'] == '')
{
$action = "category";
} else {
$action = htmlspecialchars($_GET['action'], ENT_QUOTES);
}
$actions_array = array("body", "stats", "search", "faq", "userupload", "category", "downloads", "allfiles", "register", "lostpwd", "cp", "login", "logout", "failed");
if(in_array($action, $actions_array))
{
if(@file_get_contents("includes/".$action.".php"))
{
include("includes/".$action.".php");
Código PHP:
<form method='post' action='index.php?action=search'>
<table>
<td>Buscar por: <td><select name='query' class='select'>
<option SELECTED value='dName'>Nombre</option>
<option value='author'>Idioma</option>
<option value='dDesc'>Descripcion</option>
</select>
<td >Ordenar por: <td><select name='order' class='select'>
<option value='dName'>Nombre</option>
<option SELECTED value='rating'>Ranquing</option>
<option value='count'>Descargas</option>
</select>
<td><input type='text' size='35' maxlength='25' name='text'>
<td>Excata <input type='checkbox' name='exact' value='1'>
<input type='submit' name='find' value='Buscar'>
</table>
</form>
Código PHP:
<?php
require_once("dowcat.php");
if($_GET['id'] != '')
{
$cat = mysql_real_escape_string(stripslashes($_GET['id']));
} else {
$cat = '0';
}
if(isset($_POST['find']))
{
$query = mysql_real_escape_string(htmlentities(clean($_POST['query']), ENT_QUOTES));
$exact = mysql_real_escape_string(htmlentities(clean($_POST['exact']), ENT_QUOTES));
$text = mysql_real_escape_string(htmlentities(clean($_POST['text']), ENT_QUOTES));
if($cID > '0')
{
$cat = "&& cID = '".$cID."'";
} else {
$cat = "";
}
// SEARCH FOR EXACT MATCH
if($exact == '1')
{
$sql = mysql_query("SELECT * FROM ".DB_PREFIX."downloads WHERE ".$query." = '".$text."' ".$cat." ORDER BY ".$order." DESC");
if(mysql_num_rows($sql) == '0')
{
$search_page = "{*NO_RESULTS*}<br /><br />
<a href='index.php?action=search'>{*SEARCH_AGAIN*}</a>";
} else {
$search_page = "<h2>".mysql_num_rows($sql)." resultados para ".$text."</h2>
<div class='main2'>
<table width='755px' >
<td>Programa</td>
<td>Descripcion</td>
<td>Idioma</td>
<td>Descargas</td>
<td>Importacia</td>";
while($d=mysql_fetch_array($sql))
{
$dID=$d["dID"];
$sticky=$d["sticky"];
$dName=stripslashes($d["dName"]);
$dDesc=substr(stripslashes($d["dDesc"]), 0, 50);
$dCreator=stripslashes($d["author"]);
$creatorEmail=stripslashes($d["email"]);
$dateAdd=$d["dateAdd"];
$count=$d["count"];
$fSticky = '';
if($sticky == '1')
{
$fSticky = "{*PINNED*} ";
}
$search_page .= "<tr>
<td>".$fSticky."<a href='index.php?action=downloads&id=".$dID."'>".$dName."</a>
<td >".$dDesc."
<td >".$dCreator."
<td>".$count."</td>
<td>".rating($dID,1)."</td>
</tr>";
}
$search_page .= "</table><br>
<h3><a href='index.php?action=search'><b>{*SEARCH_AGAIN*}</b></a></h3></div>";
}} else {
// SEARCH FOR NON-EXACT MATCHES
$sql = mysql_query("SELECT * FROM ".DB_PREFIX."downloads WHERE ".$query." LIKE '%".$text."%' ".$cat." ORDER BY ".$order." DESC");
if(mysql_num_rows($sql) == '0')
{
$search_page = "{*NO_RESULTS*}<br /><br />
<a href='index.php?action=search'>{*SEARCH_AGAIN*}</a>";
} else {
$search_page = "<h2>".mysql_num_rows($sql)." resultados para ".$text."</h2>
<div class='main2'>
<table width='755px' >
<td><b>Programa</b></td>
<td><b>Descripcion</b></td>
<td><b>Idioma</b></td>
<td><b>Descargas</b></td>
<td><b>Importacia</b></td>";
while($d=mysql_fetch_array($sql))
{
$dID=$d["dID"];
$sticky=$d["sticky"];
$dName=stripslashes($d["dName"]);
$dDesc=substr(stripslashes($d["dDesc"]), 0, 50);
$dCreator=stripslashes($d["author"]);
$creatorEmail=stripslashes($d["email"]);
$version=$d["version"];
$count=$d["count"];
$fSticky = '';
if($sticky == '1')
{
$fSticky = "{*PINNED*} ";
}
$search_page .= "<tr>
<td>".$fSticky."<a href='index.php?action=downloads&id=".$dID."'>".$dName."</a>
<td >".$dDesc."
<td >".$dCreator."
<td>".$count."</td>
<td>".rating($dID,1)."%</td>
</tr>";
}
$search_page .= "</table><br>
<h3><a href='index.php?action=search'><b>{*SEARCH_AGAIN*}</b></a></h3></div>";
}}
}
$search_page = lang_convert($search_page);
// Display the page
echo $search_page;
?>