Ver Mensaje Individual
  #1 (permalink)  
Antiguo 03/12/2005, 05:02
Navarro_2c+
 
Fecha de Ingreso: diciembre-2005
Mensajes: 3
Antigüedad: 18 años, 4 meses
Puntos: 0
Problemas al pasar variables desde HTML a PHP

Muy buenas a todos. Este es el primer mensaje que envío al foro y espero no meter mucho la pata y que se me entienda bien lo que pretendo.

En mi ordenador he instalado "EasyServer", que me incluye el 'Apache 1.3', el 'PHP 4.1' y 'MySQL'. Aparentemente está bien configurado, aunque no estaría del todo seguro.

Os mando el contenido de mi 'http.conf' por si alguien ve alguna cosa que no está bien me lo indique (por favor), si tiene a bien.

httpf.cong

Cita:
ServerType standalone
ServerRoot "I:/Servidor/apache/"
PidFile logs/httpd.pid
ScoreBoardFile logs/apache_runtime_status
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 15
MinSpareServers 50
MaxSpareServers 100

MaxClients 150
MaxRequestsPerChild 30

ThreadsPerChild 50
BindAddress *
<Files .quota>
order allow,deny
deny from all
allow from none
</Files>

<Files .htaccess>
order allow,deny
deny from all
allow from none
</Files>

<Files ~ ".inc$">
Order allow,deny
Deny from all
Satisfy All
</Files>

<Files ~ ".conf$">
Order allow,deny
Deny from all
Satisfy All
</Files>

<Files ~ "^.auth$">
Order allow,deny
Deny from all
Satisfy All
</Files>

LoadModule php4_module I:/Servidor/php/sapi/php4apache.dll
LoadModule anon_auth_module modules/mod_auth_anon.so
#LoadModule dbm_auth_module modules/mod_auth_dbm.so
LoadModule digest_auth_module modules/mod_auth_digest.so
#LoadModule cern_meta_module modules/mod_cern_meta.so
LoadModule digest_module modules/mod_digest.so
#LoadModule expires_module modules/mod_expires.so
LoadModule headers_module modules/mod_headers.so
#LoadModule proxy_module modules/mod_proxy.so
LoadModule rewrite_module modules/mod_rewrite.so
#LoadModule speling_module modules/mod_speling.so
#LoadModule info_module modules/mod_info.so
LoadModule status_module modules/mod_status.so
LoadModule usertrack_module modules/mod_usertrack.so
ExtendedStatus on
Port 80
ServerAdmin web-admin@localhost

ServerName localhost

DocumentRoot "I:/Servidor/www"

<Directory "I:/Servidor/www">
Options Indexes Includes FollowSymLinks MultiViews ExecCGI
AllowOverride Options FileInfo AuthConfig
Order allow,deny
Allow from All
</Directory>

<IfModule mod_userdir.c>
UserDir "I:/Servidor/apache/users/"
</IfModule>

<IfModule mod_dir.c>
DirectoryIndex index.html index.htm index.php index.php3 index.php4 default.htm default.php
AddType application/x-httpd-php .php .php3 .php4 .phtml
AddType application/x-httpd-php-source .phps
</IfModule>

AccessFileName .htaccess
UseCanonicalName On
<IfModule mod_mime.c>
TypesConfig conf/mime.types
</IfModule>
DefaultType text/plain
<IfModule mod_mime_magic.c>
MIMEMagicFile conf/magic
</IfModule>
HostnameLookups Off
ErrorLog logs/error.log
LogLevel warn
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
CustomLog logs/access.log common
ServerSignature On
<IfModule mod_alias.c>
Alias /icons/ "I:/Servidor/apache/icons/"

<Directory "I:/Servidor/apache/icons">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
ScriptAlias /php/ "I:/Servidor/php/"
<Directory "I:/Servidor/www/cgi-bin">
AllowOverride All
Options None
</Directory>
</IfModule>
<IfModule mod_autoindex.c>
IndexOptions FancyIndexing
AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip

AddIconByType (TXT,/icons/text.gif) text/*
AddIconByType (IMG,/icons/image2.gif) image/*
AddIconByType (SND,/icons/sound2.gif) audio/*
AddIconByType (VID,/icons/movie.gif) video/*

AddIcon /icons/binary.gif .bin .exe
AddIcon /icons/binhex.gif .hqx
AddIcon /icons/tar.gif .tar
AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv
AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip
AddIcon /icons/a.gif .ps .ai .eps
AddIcon /icons/layout.gif .html .shtml .htm .pdf
AddIcon /icons/text.gif .txt
AddIcon /icons/c.gif .c
AddIcon /icons/p.gif .pl .py
AddIcon /icons/f.gif .for
AddIcon /icons/dvi.gif .dvi
AddIcon /icons/uuencoded.gif .uu
AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl
AddIcon /icons/tex.gif .tex
AddIcon /icons/bomb.gif core

AddIcon /icons/back.gif ..
AddIcon /icons/hand.right.gif README
AddIcon /icons/folder.gif ^^DIRECTORY^^
AddIcon /icons/blank.gif ^^BLANKICON^^

DefaultIcon /icons/unknown.gif
ReadmeName README
HeaderName HEADER
IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t
</IfModule>

<IfModule mod_mime.c>
AddEncoding x-compress Z
AddEncoding x-gzip gz tgz
AddLanguage da .dk
AddLanguage nl .nl
AddLanguage en .en
AddLanguage et .ee
AddLanguage fr .fr
AddLanguage de .de
AddLanguage el .el
AddLanguage he .he
AddCharset ISO-8859-8 .iso8859-8
AddLanguage it .it
AddLanguage ja .ja
AddCharset ISO-2022-JP .jis
AddLanguage kr .kr
AddCharset ISO-2022-KR .iso-kr
AddLanguage no .no
AddLanguage pl .po
AddCharset ISO-8859-2 .iso-pl
AddLanguage pt .pt
AddLanguage pt-br .pt-br
AddLanguage ltz .lu
AddLanguage ca .ca
AddLanguage es .es
AddLanguage sv .se
AddLanguage cz .cz
AddLanguage ru .ru
AddLanguage tw .tw
AddLanguage zh-tw .tw
AddCharset Big5 .Big5 .big5
AddCharset WINDOWS-1251 .cp-1251
AddCharset CP866 .cp866
AddCharset ISO-8859-5 .iso-ru
AddCharset KOI8-R .koi8-r
AddCharset UCS-2 .ucs2
AddCharset UCS-4 .ucs4
AddCharset UTF-8 .utf8

<IfModule mod_negotiation.c>
LanguagePriority en da nl et fr de el it ja kr no pl pt pt-br ru ltz ca es sv tw
</IfModule>

AddType application/x-httpd-php .php4 .php .htm .php3 .inc .fire
AddType application/x-httpd-php-source .phps

AddType application/x-tar .tgz

AddHandler cgi-script .cgi
AddHandler cgi-script .pl
AddHandler server-parsed .shtml
</IfModule>

Action application/x-httpd-php i:/Servidor/php/php.exe

ErrorDocument 404 /404.htm

<IfModule mod_setenvif.c>

BrowserMatch "Mozilla/2" nokeepalive
BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0
BrowserMatch "RealPlayer 4\.0" force-response-1.0
BrowserMatch "Java/1\.0" force-response-1.0
BrowserMatch "JDK/1\.0" force-response-1.0
</IfModule>
Pues bien, ahora vamos con el problema:

Tengo un programa de prueba en un archivo HTML que me pide que introduzca texto en un formulario.

Cuando le doy al botón de "submit" me redirecciona a un programa PHP que lo único que debiera de mostrar es el contenido de la variable del formulario, vamos, lo que se haya escrito.

El resultado es desesperante porque no se genera ningún error, el explorador redirecciona bien hacia el archivo PHP, pero no pasa ninguna variable. ¿¿??

Estoy haciendo esta sencilla prueba porque tengo que hacer un programa que gestione una base de datos MySQL sobre Apache y tengo todo listo, sólo me falta que las variables "bailen" de un archivo a otro. ESTOY ATASCADO.


Os voy a poner el código:


--- Archivo: entrada.htm ----
<html> <body>

<form method="post" action="formulario.htm">

<input type="submit" value="Ir a buscar" name="buscar">

</form>

</body> </html>



--- Archivo: formulario.htm ---
<html> <body>

<form method="POST" action="buscador.php3">

<strong>Palabra clave:</strong>
<input type="text" name="T1" value "Pon tu cadena aquí" size="50">
<input type="submit" value="Aceptar el contenido" name="buscar">
</form>

</body> </html>


--- Archivo: buscador.php3 --- (el que debiera de mostrar la cadena)
<html> <body>

<?php

if (!isset($buscar))
{
echo "Debe especificar una cadena a buscar";
echo "</html></body> \n";
exit;
}

echo $buscar;


/* En realidad, el código que debiera ejecutarse sería este de abajo, pero primero tengo que salir del atasco... ¿porqué no me pasa ningún valor a la variable $buscar?, NECESITO AYUDA.


$link = mysql_connect("localhost", "nobody");
mysql_select_db("mydb", $link);
$result = mysql_query("SELECT * FROM agenda WHERE nombre LIKE '%$buscar%' ORDER BY nombre", $link);

echo "Contenido de $result:".$result."\n";
echo "<td></td> \n";
echo "Contenido de $buscar:".$buscar."\n";
echo "<td></td> \n";

if ($row = mysql_fetch_array($result))
{
echo "<table border = '1'> \n";

//Mostramos los nombres de las tablas
echo "<tr> \n";
while ($field = mysql_fetch_field($result))
{
echo "<td>$field->name</td> \n";
}
echo "</tr> \n";
do {
echo "<tr> \n";
echo "<td>".$row["id"]."</td> \n";
echo "<td>".$row["nombre"]."</td> \n";
echo "<td>".$row["direccion"]."</td> \n";
echo "<td>".$row["telefono"]."</td> \n";
echo "<td><a href='mailto:".$row["email"]."'>".$row["email"]."</a></td> \n";
echo "</tr> \n";
} while ($row = mysql_fetch_array($result));
echo "</table> \n";
}
else
{
echo "¡ No se ha encontrado ningún registro !";
}

*/

?>

</body>
</html>


Bueno, pues eso es todo. Se que ha sido un poco largo y seguro que lo de revisarme la configuración del Apache y del PHP será más rollo todavía, pero es que soy novato en esto y seguro que he metido la pata en cualquier tontería... En fin, que ya no sé que hacer y espero, si alguien pudiera que me echara una mano. Gracias.