| 1:45 pm on May 7, 2003 (gmt 0)|
Change your form line to:
<input type=hidden name="id" value="<?=SERVER['REMOTE_USER']?>">
Which will interrupt the HTML and tell it to output that PHP variable.
| 2:13 pm on May 7, 2003 (gmt 0)|
Thanks. Seemed to make sense, but when I tried it, my echo "$id"; was just blank this time.
| 2:30 pm on May 7, 2003 (gmt 0)|
Oops I forget the $$$$_ :)
<input type=hidden name="id" value="<?=$_SERVER['REMOTE_USER']?>">
| 2:31 pm on May 7, 2003 (gmt 0)|
Shouldn't that be $_SERVER['REMOTE_USER']?
| 2:32 pm on May 7, 2003 (gmt 0)|
I guess it should ;o)
| 2:44 pm on May 7, 2003 (gmt 0)|
Still didn't work. The field on browser was still blank, and when I looked at the source code for my php file, it said:
[PHP]Your user id is <?=$_SERVER[\'REMOTE_USER\']?>.[/PHP]
Maybe it won't work because the php file's on a different server that doesn't require authentication?
| 2:50 pm on May 7, 2003 (gmt 0)|
I've never used that specific variable, so hopefully someone else can help!
| 2:56 pm on May 7, 2003 (gmt 0)|
Okay, thanks for trying. I didn't think it would be that difficult to do...grabbing a username. But, again, it could have to do with the fact that the files are on two different servers.
| 4:57 pm on May 7, 2003 (gmt 0)|
The easiest way to program with these variables is to look at a phpinfo script to see what variables are being passed from your browser. If you don't know what that is, it's a simple one line script with <? phpinfo();?>
| 5:33 pm on May 7, 2003 (gmt 0)|
Thanks. I do have a phpinfo file. The only problem is that is run on the server that is not password protected, so it wouldn't show any values for username and password.
I can get the username via a cgi script, so, I guess the solution, for now, would be to get it that way and then pass it on the php script. I was just trying to get away from having to use the cgi. Thanks for your help.
| 7:04 pm on May 7, 2003 (gmt 0)|
|...capture his/her username on my html form and then send it as a hidden value to the php script, which is on a different server... |
<note to self>Read a little more carefully next time</note to self>
The php code <?=$_SERVER['REMOTE_USER']?> is in an html file running on a server that doesn't parse php, so the php code isn't going to do anything. The html code is doing what it ought to: sending the value of 'id', literally <?=$_SERVER['REMOTE_USER']?>, to the second server.
> I can get the username via a cgi script...
| 7:37 pm on May 7, 2003 (gmt 0)|
Thanks, toadhall. And, as it turns out, I couldn't even get it to work with CGI. I searched bulletin boards all over and saw others who were asking the same question (with no responses), so a lot of others were(are) having the same problem that I am.
Thought it might have to do with <Limit Get> in my .htaccess file, but when I changed to <Limit Get Post>, I still wasn't able to capture the remote_user name.
Luckily, the number of people completing this particular survey is small (31) so I'll probably wind up just creating a table and reentering all access codes there.