Justtechjobs.com Find a programming school near you






Online Campus Both


php-db | 2000121

[PHP-DB] RE: [PHP-WIN] Kinda silly question From: Ignatius Teo (iteo <email protected>)
Date: 12/13/00

A couple of things:

1. You have error_reporting turned on too high (which is not necessarily a bad thing) - which is why you are getting the error;

2. It is generally bad form to echo html using echo (or print) "<html>" - it is better form to break out of PHP into HTML...eg:
        <?
        if ($comp) {
        ?>
        .
        .
        .
        <?
        } else {
        ?>
                <FORM ACTION="<? echo $PHP_SELF;?>" METHOD="POST">
                .
                .
                </FORM>
        <?
         }
        ?>

3. You are missing a closing single quote in the first line, although that is not the real problem:
        echo "<form name='form' action='$PHP_SELF">";
        should read:
        echo "<form name='form' action='$PHP_SELF'">";
                                                 ^
PS: You could also say;
        echo "<form name=\"form\" action=\"$PHP_SELF\"">";

Hope this helps.

Ignatius

> -----Original Message-----
> From: DEWA [mailto:dwa <email protected>]
> Sent: Thursday, 14 December 2000 15:44
> To: php-windows <email protected>
> Cc: php-db <email protected>
> Subject: [PHP-WIN] Kinda silly question
>
>
> 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 ...
> 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
>
>