Jump to content

PHP variable within a form


pacman99

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~
Link to comment
https://forums.phpfreaks.com/topic/8715-php-variable-within-a-form/
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)

Archived

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

×
×
  • Create New...

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.