Jump to content

Archived

This topic is now archived and is closed to further replies.

pacman99

PHP variable within a form

Recommended Posts

Hi,
I'm not sure this is possible and I'm no expert php programmer so hopefully this question isn't too stupid.

Basically what I want to do is use a php variable within a form.

[code]<form>
<input type="hidden" name="blah" value=(PHPVARIABLEHERE) >
</form>[/code]

the PHP variable i'm trying to use is PHP_AUTH_USER and PHP_AUTH_PW but not sure how to go about doing it? If I use
[code] value=<?php $_SERVER['PHP_AUTH_USER'] ?> [/code]
it doesn't work.

Any ideas?

Basically i'm trying to get the username and password data from the server (used to access the page using .htaccess) and implementing it so it automatically logs someone into the phpBB2 forum I have.

Thanks~

Share this post


Link to post
Share on other sites
[code] value=<?php echo $_SERVER['PHP_AUTH_USER'];  ?> [/code]

Share this post


Link to post
Share on other sites
^the textbox ends up saying
[code]<?php[/code]
when I put that.

[code]<input type="text" class="post" name="username" value=<?php echo $_SERVER['PHP_AUTH_USER']; ?>[/code]
This is what i'm putting.

Share this post


Link to post
Share on other sites
sounds like your web host has PHP turned off on your account. That, or your file is named with the ".html" extension instead of ".php"

Share this post


Link to post
Share on other sites
[!--quoteo(post=370002:date=Apr 29 2006, 09:26 PM:name=michaellunsford)--][div class=\'quotetop\']QUOTE(michaellunsford @ Apr 29 2006, 09:26 PM) [snapback]370002[/snapback][/div][div class=\'quotemain\'][!--quotec--]
sounds like your web host has PHP turned off on your account. That, or your file is named with the ".html" extension instead of ".php"
[/quote]

nevermind, hooker's code works fine. Thanks a lot. Just a minor stupid error on my part (I named the file with an .html extension rather than php...yep that was stupid)

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.