On Monday, February 18, 2002, at 05:50  PM, Narvaez, Teresa wrote:

> When I execute the code below, why is PHP_SELF undefined? I will
> appretiate
> any help on this. I can get its value by:
>      echo $_SERVER["PHP_SELF"];    Thanks in advance! -Teresa
>
>
> <HTML>
> <HEAD>
> <TITLE>Feedback</TITLE>
> </HEAD>
> <BODY>
> <?
> $form_block = "
> <FORM method=\"POST\" action=\"$PHP_SELF\">
                                  ^^^^^^^^^

It hasn't been pulled from the $_SERVER array.  It worked for you when 
you did it the first way, so try doing it that same way in the code:

<form method=\"post\" action=\"" . $_SERVER['PHP_SELF'] . "\">

Note that I had to "jump out" of the string and concatenate it to the 
variable, because PHP doesn't let you just use $_* variables in the 
middle of a string.  I also made sure to "jump back into" the string to 
finish the HTML form tag.

If you don't like doing it this way, do something like

$PHP_SELF = $_SERVER['PHP_SELF'];
$form_block = "<form method=\"post\" action=\"$PHP_SELF\">";


HTH

Erik



----

Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


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

Reply via email to