Re: Kinda silly question
| From: | Zak Greant | Date: | Thu, 14 Dec 2000 04:50:04 +0000 |
| Subject: | Re: Kinda silly question | ||
| References: | 1 | Groups: | php.db php.windows |
| Request: | Send a blank email to php-db+get-5229@lists.php.net to get a copy of this message | ||
DEWA wrote:
>Maybe this one is a silly question ...
>
>Could someone teach me about that damn $PHP_SELF ???
>coz until now i can't get it work in anyway .. so i have to make a lot of
pages.
>
>i mean like whenever i wanna use it, it gaves me an error ...
$PHP_SELF is not what is causing your problem. Instead, you are trying to
use a variable ($comp) that has not been defined. This is not usually a
problem with PHP. However, PHP has many different levels of error
reporting. The most strict level of error reporting will complain if a
variable is not set when you use it.
Try doing the two following things:
Change the line that reads:
if ($comp) {
to
if (isset ($comp)) {
- or -
Add this line at the top of your code:
error_reporting (E_ALL & ~ E_NOTICE);
This will lower the error reporting to a level that is easier for beginners
to deal with.
Good Luck!
--zak
>ex:
>if ($comp) {
> bla bla bla
>} else {
>echo "<form name='form' action='$PHP_SELF">";
>echo "<input type='text' name='comp'>";
>echo "<input type='submit' value='get it'>";
>echo "</form>";
>
>or
>
>echo "<form name='form' action='$PHP_SELF">";
>echo "<input type='text' name='comp'>";
>echo "<input type='submit' value='get it'>";
>echo "</form>";
>
>print "$comp";
>
>
>It always said that :
>Warning: Undefined variable: comp in c:\homepage\modify.php on line 10