Foros del Web » Programando para Internet » PHP »

problema con formulario

Estas en el tema de problema con formulario en el foro de PHP en Foros del Web. hola tengo un prublema con un formulario externo al script. El formulario se encuentra cargado en un bd index.php va tomando otros scripts que toman ...
  #1 (permalink)  
Antiguo 03/03/2008, 06:01
p2pdownloading
Invitado
 
Mensajes: n/a
Puntos:
problema con formulario

hola tengo un prublema con un formulario externo al script.

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"); 
form en la bd
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
search.php
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"]), 050);
    
$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"]), 050);
    
$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;

?>
  #2 (permalink)  
Antiguo 03/03/2008, 09:22
Avatar de GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 18 años
Puntos: 2135
Re: problema con formulario

Que Servidor Web utilizas en tu host remoto?, he comprobado que si usas IIS, no reconoce las variables cuando tu envías un formulario mixto (variables con POST, junto con GET).

Saludos.
  #3 (permalink)  
Antiguo 03/03/2008, 09:46
p2pdownloading
Invitado
 
Mensajes: n/a
Puntos:
Re: problema con formulario

hola!

Creo que te refieres a esto

Versión 2.0 de Servidor de HTTP Apache

aca esta el manual

http://software-p2p.com/manual/

saludos
  #4 (permalink)  
Antiguo 03/03/2008, 10:10
Avatar de GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 18 años
Puntos: 2135
Re: problema con formulario

Prueba hacer un var_dump( $_GET, $_POST ) y verifica si te están llegando todas las variables al inicio de tu script.

Saludos.
  #5 (permalink)  
Antiguo 03/03/2008, 10:37
p2pdownloading
Invitado
 
Mensajes: n/a
Puntos:
Re: problema con formulario

si llegan todas, q extraño...

para la busqueda "ARES"

array(4) { ["query"]=> string(5) "dName" ["order"]=> string(6) "rating" ["text"]=> string(4) "ARES" ["find"]=> string(6) "Buscar" }

tiene q ser problema del script ?

lo q es extraño es q funcionaba perfecto desde localhost en mi pc.
  #6 (permalink)  
Antiguo 03/03/2008, 11:08
p2pdownloading
Invitado
 
Mensajes: n/a
Puntos:
Re: problema con formulario

solucionado!
el problema era del script


saludos!
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 23:36.