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 8267739
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T05:38:23+00:00 2026-06-08T05:38:23+00:00

I have a script that I’m using that when the user enters a code

  • 0

I have a script that I’m using that when the user enters a code I want it to add to the total in the database, however nothing is happening.

This is my code so far:

$err = array();
if (isset($_POST['doSubmit4']) === true ) // Was if ($_POST['access']=='submit')
{
$code = mysql_real_escape_string($_POST['access-key']); // Was $data['access-key']
$result = mysql_query("SELECT `akid`,`key`,`total_access` FROM access_keys WHERE id='$_SESSION[user_id]' AND type='1'") or die (mysql_error()); 
$num = mysql_num_rows($result);
// Match row found with more than 1 results  - the key exists. 
if ( $num > 0 ) {   
    list($akid,$key,$total_access) = mysql_fetch_row($result);
    if ($code == $key) { 
        if(empty($err)){
            $total_access++;
            mysql_query("update access_keys set total_access='$total_access' where akid='$akid'") or die(mysql_error());
            header("Location: ./");
        }
    } else {
        $err[] = "Invalid Access Key. Please try again with correct access key.";
    }
} else {
    $err[] = "Error - Invalid Access Key. No access exists for your user ID.";
}       
}

I’m wanting it to add to the Total Access field each time the user enters the correct code, but it’s not working.

This is my form code:

<form name="postAccess" id="postAccess" method="post" action="access.php">
    <input type="password" name="access-key" id="access-key" style="background-color:black;color:white;" size="40" /><br/>
    <input name="doSubmit4" type="submit" id="doSubmit4" value="submit">
</form>
  • 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-08T05:38:26+00:00Added an answer on June 8, 2026 at 5:38 am

    It might be your parent if brackets.

    Try:

    if (isset($_POST['access']) === true )
    

    instead of

    if ( $_POST['access']=='submit' )
    

    If that doesn’t seem to do it, do some debugging.

    Throw some echo statements in those if brackets to see what conditions are true and what are not.

    EDIT:

    I just realized another problem.

    Your form action is invalid. This should be the path to the page you are posting the data to. So:

    Instead of:

    <form name="access" id="access" method="post" action="access">

    You should have:

    <form name="access" id="access" method="post" action="your-php-path-here.php">
    

    Notice how action = “your-php-path-here.php” in the above code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an script that adds products to a remote database using a RESTful
I have a script that I only want to be running one time. If
I have this script that will let the user download the data from the
Have a script that using jquery validation. Tested on 2 Blackberry's and neither worked
I have a script that creates a random string and I want to turn
I have a script that pulls data from a database, and based on the
I have a script that is supposed to read from the database and return
I have a script that write a iframe into the page. I want to
I have a script that, inserts into the database e.g. 20,000 users with email
I have a script that calls an application that requires user input, e.g. run

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.