http://www.html-form-guide.com/php-form ... -post.htmlEn contre un POST muy interesante que me ilustro un poco sobre el uso del POST y como ensamblar todo lo leido, sin embargo no funciona. Pruncipalmente he visto que hay codigo que deberia trabahar bien y sin embargo no funciona. Por ejemplo lo referente a "Register globals"
"Register globals off?
If you are using a version of PHP earlier than 4.2.0, you should strongly consider setting register_globals to "off" in your .htaccess file (if you are using Apache server) for the exact same reasons as were mentioned in the previous tutorial on GET. If you have PHP 4.2.0 or later, don't worry about it."
Con el comando phpinfo() vi que lo referente a las variables globales tenia los siguientes valores:
register_globals = Off
auto_globals_jit = On
Esto esta en el archivo /etc/php5/apache2/php.ini
En la pagina de PHP encontre lo siguiente:
Using Register Globals: This feature has been DEPRECATED as of PHP 5.3.0. Relying on this feature is highly discouraged.
EL valor de mi variable es correcto y mas aun cuando tengo PHP5.
Verifique con cuidado donde poner mis echos y escribí el siguiente script que pareciera no trabajar antes de tener los ECHOs. En conclusión las variables hay que pasarlas usando el formato $_POST['variable']
<html>
<head><basefont face="Arial"></head>
<body>
<h2>Address Book</h2>
<?php
// form not yet submitted
// display form
echo "DEBUG1 ". $_POST['submit'] . "<br>";
echo "DEBUG1 ". $_SERVER['PHP_SELF'] . "<br>";
if (!isset($_POST['submit']))
{
?>
<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST">
Name:<br>
<input name="name" type="text" size="50">
<input type="submit" id="submit" name="submit" value="Add">
</form>
<?php
}
else
{
// form submitted
echo "DEBUG2 " . $_POST['submit'] . "<br>";
echo "DEBUG2 " . $_POST['name'];
$host = "localhost";
$user = "ryan";
$db = "test";
// open a connection to the database server
$connection = "$host" . "$db" . "$user";
echo "<h1>$conection<br></h1>";
echo $_POST['name'];
}
?>
</body>
</html>