why this sript doesn't work
| From: | J. P. | Date: | Mon, 24 Mar 2003 22:23:28 +0000 |
| Subject: | why this sript doesn't work | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-141350@lists.php.net to get a copy of this message | ||
Hello!
I am using Apache 2.0.44 and WinXP. I have PHP 4.3.1.
When i run the script the first page appears. But when i submit nothing
appends. What's wrong?
<?php
function mostrar_formulario()
{
global $PHP_SELF;
?>
<form action="<?php echo $PHP_SELF; ?>" method="post">
Nome: <input type="text" name="nome" maxlength="50"><br>
Email: <input type="text" name="email" maxlength="50"><br>
<br>
Qual a sua linguagem de programação preferida?<br>
<input type="radio" name="linguagem" value="PHP">PHP<br>
<input type="radio" name="linguagem" value="C++">C++<br>
<input type="radio" name="linguagem" value="C">C<br>
<input type="radio" name="linguagem" value="PERL">PERL<br>
<br>
Qual o seu browser web preferido?<br>
<input type="radio" name="browser" value="Netscape
Navigator">Netscape
Navigator<br>
<input type="radio" name="browser" value="Internet
Explorer">Internet
Explorer<br>
<br>
<input type="submit" value="Submeter dados">
</form>
<?php
}
?>
<?php
function processa_formulario() {
global $nome;
global $email;
global $linguagem;
global $browser;
printf ("O utilizador %s cujo endereço de email é %s prefere a linguagem de
programação %s e utiliza, normalmente, o browser %s para navegar na www.",
$nome, $email, $linguagem, $browser);
}
?>
<?php
if (empty($nome)){
mostrar_formulario();
} else {
processa_formulario();
}
?>
Thanks