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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T04:55:09+00:00 2026-06-18T04:55:09+00:00

After looking about for a bit I’ve created a PHP form which I want

  • 0

After looking about for a bit I’ve created a PHP form which I want to save the data when an error is thrown. The odd thing about this is that it works when I test it in a local WAMP installation, but as soon as I move it to the server hosted online it doesn’t.

My form is this:

<form action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>" method="post" enctype="multipart/formdata"><div class="formlabel">Username:</div>
<input type="text" id="username" name="username" value="<?= @$_POST['username'] ?>"/>
<small class="errorText"><?php echo $throwError["username"]; ?></small>
<br><div class="formlabel">Password:</div>
<input type="password" id="password" name="password" value="<?= @$_POST['password'] ?>"/>
<small class="errorText"><?php echo $throwError["password"]; ?></small>
<br>
<small class="errorText"><?php echo $throwError["validate"]; ?></small>
<input type="submit" name="submit" value="Login"/>
</form>

And currently when it runs, this is the action:

$throwError = array(
    "username" => "",
    "password" => "",
    "validate" => ""
);

if(isset($_POST['submit'])) {
    $username = trim($_POST['username']);
    $password = trim($_POST['password']);
    setCookie('memberID', $username);

    if (!empty($username) && !empty($password)) {
        $result = mysql_query("SELECT * FROM member WHERE member_id='$username' AND password='$password'", $linkid);
        if(!$result || mysql_num_rows($result) <= 0) {
            $throwError["validate"] = "Please enter a valid username and password";
            return false;
        }
        return true;
    }

    if (empty($username)){
        $throwError["username"] = "Please enter your username";
    }

    if (empty($password)){
        $throwError["password"] = "Please enter your password";
    }
}

When this is hosted on Wamp and viewed via localhost, if I type a username and no password (and vice versa) I see my error, and the username/password stays input into the form. However, I uploaded this to the server and all I see is <?=@_POST['username'] ?> as a string in the input username, and likewise (but hidden) in the password box.

Not even sure this is related to the code, but perhaps there’s a way to do the same thing a different way which is why I felt the need to post it.

Any theories are appreciated!

  • 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-18T04:55:11+00:00Added an answer on June 18, 2026 at 4:55 am

    Maybe if you set

    short_open_tag = On 
    

    in php.ini and restart your Apache server.

    Source.

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

Sidebar

Related Questions

After learning about the Action delegate in C# I've been looking for ways I
I am working on a php/mysql login system for a webproject. After looking through
I’m after a bit of advice on the best way to go about this
I'm looking for a book about Xcode. I wonder which one might be good
After reading a bit more about how Gnutella and other P2P networks function, I
i've read a bit about ROWCOUNT but its not exactly what im looking for.
After watching Channel 9's video on F# Type Providers, I'm wondering about data schema
After learning a bit of how LLVM work I'm really excited about how portable
I am getting a bit of concerns about which way is the best to
After looking around (for not terribly long I have to admit) I wonder if

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.