pacman99 Posted April 29, 2006 Share Posted April 29, 2006 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~ Quote Link to comment Share on other sites More sharing options...
Hooker Posted April 29, 2006 Share Posted April 29, 2006 [code] value=<?php echo $_SERVER['PHP_AUTH_USER']; ?> [/code] Quote Link to comment Share on other sites More sharing options...
pacman99 Posted April 30, 2006 Author Share Posted April 30, 2006 ^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. Quote Link to comment Share on other sites More sharing options...
michaellunsford Posted April 30, 2006 Share Posted April 30, 2006 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 Link to comment Share on other sites More sharing options...
pacman99 Posted April 30, 2006 Author Share Posted April 30, 2006 [!--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) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.