1) action="<? echo $_SERVER['PHP_SELF']; ?>" 
   [works also, with register_globals=Off]

   You can also leave the action-tag blank -
   then the form always posts to itself!

2) $texto should be $_POST['texto']
   [again the autoglobals...]

3) Correct code - I hope it helps you

<html>
<head>
<title>Learning PHP</title>
</head>

<body>

<?php
if (isset($_POST['texto']) AND $_POST['texto'] != "")
echo "You typed  \"".$_POST['texto']."\"<br><br>";
?>

<form method=post action="">
<input type="text" name="texto" value="" size=10>
<br>
<input type="submit" name="sub" value="Enviar!">
</form>

</body>
</html>


Christian Leberfinger

> -----Original Message-----
> From: Saci [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, June 23, 2002 6:56 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP-WIN] Newbye question
> 
> 
> I installed php 4.2.1 on windows XP using the PHP 4.2.1 installer 
> [897Kb] -
> 13 May 2002
> 
> Apparently php is working since the classic hello word from php 
> is running,
> but I have some problems with variables
> 
> I have the following php code, who runs perfectly on my isp, but give a
> message error on my machine who use windows xp the message are
> 
> Notice: Undefined variable: texto in
> d:\inetpub\wwwroot\souio\php\teste03.php on line 5
> 
> I'm sure the code is correct because they run on my ISP (W2000) 
> without any
> problem
> 
> 
> what is wrong witch my installation?
> 
> 
> 
> The code are
> 
> <html>
> <head><title>Learning PHP</title></head>
> <body>
> <?php
> if ($texto != "")
> echo "You typed  \"$texto\"<br><br>";
> ?>
> <form method=post action="<? echo $PATH_INFO; ?>">
> <input type="text" name="texto" value="" size=10>
> <br>
> <input type="submit" name="sub" value="Enviar!">
> </form>
> </body>
> </html>
> 
> 
> 
> -- 
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to