Re: PHP3, Apache & Win98 Problem
| From: | Andy Hoffman | Date: | Fri, 17 Nov 2000 15:08:11 +0000 |
| Subject: | Re: PHP3, Apache & Win98 Problem | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-3946@lists.php.net to get a copy of this message | ||
Calvin Chang wrote:
> I have encountered one strange problem with PHP3 and Apache which run
> under Win98system.
>
> I have one Php file written as follows:
>
> <HTML>
>
> <FORM>
> Please type your name here:<BR>
> <INPUT TYPE=TEXT NAME=username<BR><BR>
> <INPUT TYPE=SUBMIT VALUE="Submit data">
> </FORM>
>
> <BR><BR>
> You type:
>
> <?
> echo($username);
> ?>
>
> </HTML>
>
> The output in browser showed results except for the contents of <? and
> ?>. I'm using Internet Explorer 5.0 for this purpose.
>
> The settings in httpd.conf file have been configured accordingly the
> normal settings as found in manual.
This really isn't a problem with Apache, PHP or Win98, at least from what
you've given above. The script simply has no way of getting the "username"
when the form is submitted. The form has nowhere to go - no action
setting.
Put the following in your <FORM> tag...
<form action="<? echo $PHP_SELF; ?>">
Then, when the user clicks "Submit", the form will be submitted to the
current script, referenced by the php system var $PHP_SELF, and THEN the
$username variable will be available. Also, make sure you close your
<input type="text"> tag (see your code above, which has no trailing
end-carat '>')
Also, check to make sure you have register_globals set to On in your
php.ini, or else the $username variable won't be automatically registered.
--
Andy Hoffman
Web Developer
Bristol-Myers Squibb
email: andy.hoffman@bms.com