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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T04:06:33+00:00 2026-06-03T04:06:33+00:00

So, I have what I believe is some really simple php/html code. I just

  • 0

So, I have what I believe is some really simple php/html code. I just do not understand how the _construct() method isn’t executing before the HTML form. Can someone please give me an explanation.

Code from my page:

<?php   class register {
        function __construct() {
            echo 'SYSTEM: This is the register page';
        }
    }

?>
    <form action="http://abc.org/test" method="POST">
    <input type="username" value="">
    <input type="password" value="">
    <input type="submit" value="Register">
    </form>

How it looks:

How it looks

EDIT
Sorry for not including this in the original post, but I’m creating the class from another page.

Page abc.com/a has this code:

<?php require './'.'register'.'.php'; 
                $obj = new register; ?>

The code at the top of this question is from register.php

  • 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-03T04:06:35+00:00Added an answer on June 3, 2026 at 4:06 am

    The class code will run after the form, because after your require line the form has already been output. Only then you instance the class, whose constructor echoes the message.

    If you want to echo before the form, just instance the class right after you define it:

    <?php   
    class register {
        function __construct() {
            echo 'SYSTEM: This is the register page';
        }
    }
    $register = new register();
    ?>
    <form action="http://abc.org/test" method="POST">
        <input type="username" value="">
        <input type="password" value="">
        <input type="submit" value="Register">
    </form>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem with some code and I believe it is because of
I have a very strange bug, which I believe is caused by some code
I have a Spring application that I believe has some bottlenecks, so I'd like
I know this isn't a straightforward question but I would really appreciate some feedback
I'm new here, also a novice programmer, and not really familiar with PHP. I
I believe I have disabled the view state on all controls as well as
I believe I have a potential threading issue. I have a user control that
I believe I have found a weird bug as follow: I want to delete
This is staight forward I believe: I have a table with 30,000 rows. When
I've recently been trying to port a C++ application. I believe I have all

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.