RE: [PHP-WIN] Kinda silly question
| From: | Ignatius Teo | Date: | Thu, 14 Dec 2000 04:51:37 +0000 |
| Subject: | RE: [PHP-WIN] Kinda silly question | ||
| References: | 1 | Groups: | php.db php.windows |
| Request: | Send a blank email to php-db+get-5230@lists.php.net to get a copy of this message | ||
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@indosat.net.id]
> Sent: Thursday, 14 December 2000 15:44
> To: php-windows@lists.php.net
> Cc: php-db@lists.php.net
> 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
>
>