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

  • Home
  • SEARCH
  • 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 9218283
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T02:49:36+00:00 2026-06-18T02:49:36+00:00

I want to do the following without JavaScript, AJAX or a database. Only HTML

  • 0

I want to do the following without JavaScript, AJAX or a database. Only HTML and PHP.

Here’s the scenario:

I have two HTML inputs in a form. This form sends the two values (name and age) by POST method. I create a user object from these values, store this values in a SESSION and then prints the users’ information below the form. I have no problem creating the user object.

How can I do it in such a way that it prints out all users’ information. For example first users enter his information and clicks submit, we have:

 - John
 - 18 years

Second user enter his information and clicks submit, we have:

- John
- 18 years

- Kevin
- 20 years

Third user enter his information and clicks submit, we have:

- John
- 18 years

- Kevin
- 20 years

- Bryan
- 19 years

and so on?

Thanks!

  • 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-18T02:49:38+00:00Added an answer on June 18, 2026 at 2:49 am

    You should store the data in an array, and append to the array on each submit.

    <?php
    
        session_start();
        $data = array();
        if(isset($_SESSION['data'])) {
            $data = $_SESSION['data'];
        }
        if(isset($_POST['name']) && isset($_POST['age'])) {
            // -- append to the array
            $data[] = array('name'=>$_POST['name'],'age'=>$_POST['age'],);
    
            // -- update the session
            $_SESSION['data'] = $data;
        }
    ?>
    <!DOCTYPE html>
    <html>
     <head>
     </head>
     <body>
        <form action="" method="post">
          Name:<br />
          <input type="text" name="name" size="10" /><br />
          Age:<br />
          <input type="text" name="age" size="2" /><br />
          <br />
            <input type="submit" />
        </form>
        <?php foreach($data as $d) { ?>
            - <?php echo $d['name']; ?><br />
            - <?php echo $d['age']; ?><br /><br />
        <?php } ?>
     </body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say I have the following scenario: <form action=/something.php method=GET>Click me</div> <script type=text/javascript><!-- $('form').submit(function(e)
I want the following functionality using php I have a csv file. Each file
Here is my scenario. I'm am HTML/CSS guy, JavaScript not so much. But this
I have the following html snippet: <a href=page1.aspx class=title>page title goes here</a><br /> <span
I have 3 file as following : output-xml.php phpsqlajax_map.htm database.php In order to get
Scenario: I have written an MVC wizard that automatically uses ajax if javascript is
I want all the lines with assert_equal and without amazon. I tried following but
I want change following javascript code to jquery code, How is it? With done
I want to display information after I enter data into the database using ajax
I use the following code to run my form ajax requests but when i

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.