Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8512455
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T04:17:08+00:00 2026-06-11T04:17:08+00:00

So Im relatively new to PHP from ASP. And After converting alot of ASP

  • 0

So Im relatively new to PHP from ASP. And After converting alot of ASP code into PHP I have come across a problem where my PHP code seems unable to find the hidden variable I have set. It worked fine in ASP and was just wondering the best way to resolve this.

Start of the Form:

<form name="LogIn" action="login.php" method="post">
                    <td bgColor=#ffffff>
                        <table align="center" cellSpacing="2" cellPadding="2" border="0">
                            <tr>
                                <td>&nbsp;</td>
                                <td align="right"><font color="#4d71a1">User name:</font>&nbsp;</td>
                                <td><input name="UserName" size="25" type="Text" autocomplete="OFF"></td>
                                <td>&nbsp;</td>
                            </tr>
                            <tr>
                                <td>&nbsp;</td>
                                <td align="right"><font color="#4d71a1">Password:</font>&nbsp;</td>
                                <td><input name="Password" size="25" type="Password" autocomplete="OFF"></td>
                                <td>&nbsp;</td>
                            </tr>

PHP script:

<? 
if ($_POST["BtnPress"]=="Pressed")
{

if ($_POST["Username"]=="*****" && $_POST["password"]=="*********")
{

$_SESSION['AdminID']="1";
header("Location: "."index.php");
}
  else
{

print "<font color=#ff0000>Sorry you cannot access this part of the site.</font>";
} 

} 
?> 

then the rest of the form:

<tr>
                                <td align="center" colspan="4">
                                    <input type="hidden" name="BtnPress" value="Pressed">
                                    <input type="Submit" value="Log In" class="mybutton" onclick="return CheckForm();">
                                </td>   
                            </tr>
                        </table>


                    </td>
                </form>

The PHP seems unable to find the variable BtnPress, its a similar problem throughout alot of my translated ASP to PHP script. Sorry if it is a simple solution but can anyone tell me where I am going wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T04:17:09+00:00Added an answer on June 11, 2026 at 4:17 am

    Do not use a hidden input to test if a form is submitted.

    use:

    if ($_SERVER['REQUEST_METHOD'] == 'POST') {
      // processing of $_POST
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm relatively new to PHP. Started learning PHP, but then come across cakePHP, which
Note: I'm relatively new to Objective-C and am coming from Java and PHP. Could
i am relatively new to php and i've encountered a very strange problem. let
I am relatively new to php and have a feeling that I am going
I'm relatively new to PHP and have been writing a project using what I
Relatively new to PHP here, but here's where I'm at: I have a simple
I am relatively new to PHP. I have drilled down a couple of levels
I'm relatively new to ruby and i came from php. One thing that it
Well I'm relatively new to the use of PHP arrays and I have the
I'm relatively new to client-side programming coming from the PHP/MySQL environment. I understand the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.