Paolo Morgano wrote:

Thank you,
  I've been able to do this, can you tell me why the pages I wrote work fine
on Lycos web space? May be older php versions worked in a different way?

It's because of a setting in php.ini. The setting is register_globals. When it is on, your old way works; the variables are automatically taken from the array by PHP. When it is off, you must get the variables from an array yourself, such as $_POST['varname']. Prior to PHP 4.2, the default was on. Starting with PHP 4.2, the default is changed to off.


Janet


Thanks and regards,

  Paolo

"Hendrik Schmieder" <[EMAIL PROTECTED]> ha scritto nel messaggio
news:[EMAIL PROTECTED]

Paolo Morgano schrieb:


Hi,
I installed PHP5 like DSO for Apache2. I can see php processed pages,

but

I miss variables... I wrote a simple page to test

index.html:

<HTML>
<BODY>
<FORM ACTION="script.php" METHOD="POST">
  Input text  <INPUT TYPE="TEXT" NAME="var" SIZE="10" MAXSIZE="20">
<INPUT TYPE="SUBMIT" VALUE="Go">
</FORM>
</BODY>
</HTML>

script.php is:
<HTML>
<BODY>
<?PHP
   echo "Insered text is: $var";
   phpinfo();
?>
</BODY>
</HTML>

The function phpinfo() works fine, but I can't print $var value

(correctly

showed PHP VARIABLES section of phpinfo())
What's wrong in my code (copied from several examples in books and net)?

Thanks,
Paolo




You should use

echo "Insered text is: " . $_POST["var"] . "<br />\n";

instead of

echo "Insered text is: $var";

Hendrik




--
Janet Valade -- janet.valade.com

Reply via email to