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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T23:07:26+00:00 2026-06-04T23:07:26+00:00

I am very new to the world of PHP . The problem that I

  • 0

I am very new to the world of PHP .
The problem that I am facing is with the use of back button . When I click on the back button from page2 to page1 the options which I had selected on page1 is not getting saved . So I need to select all the data once again in page1 . I am using sessions . The funny part is when I use a text box question on page 1 and submit its value to page 2 and then click on back button on page2 the data is being saved . Please take a look into this code
I named this file as 1.php

<?php
  session_start();
?>
<html>
<body>
<form action="2.php" method="post">

Name<input type="text" name="name" value="<?php if(isset($_SESSION['name'])) echo $_SESSION['name']; ?>"/>


<input type="submit"  value="next"/>
</form>
</body>
</html>

I named this file as 2.php

<?php
session_start();
$name = $_POST['name'];
session_register('name');

?>
<html>
<body>
<form action="1.php" method="post">

<input type="submit"  value="back"/>
</form>
</body>

The problem is that I do not know how to implement this on the radio buttons . Could you please help me out
Thanks in advance

  • 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-04T23:07:29+00:00Added an answer on June 4, 2026 at 11:07 pm

    Try this one,

    1.php

    <?php
      session_start();
    ?>
    <html>
    <body>
    <form action="2.php" method="post">
    
    Radio1 <input type="radio" name="name" value="radio1" <?php if($_SESSION['name'] == 'radio1') echo "checked='checked'" ?>/><br/>
    Radio2 <input type="radio" name="name" value="radio2" <?php if($_SESSION['name'] == 'radio2') echo "checked='checked'" ?>/><br/>
    Radio3 <input type="radio" name="name" value="radio3" <?php if($_SESSION['name'] == 'radio3') echo "checked='checked'" ?>/><br/>
    
    <input type="submit"  value="next"/>
    </form>
    </body>
    </html>
    

    2.php

    <?php
    session_start();
    $name = $_POST['name'];
    $_SESSION['name'] = $name;
    
    ?>
    <html>
    <body>
    <form action="1.php" method="post">
    
    <input type="submit"  value="back"/>
    </form>
    </body>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am relatively new to PHP/MySQL and have been having a problem that I
I am very new to php and simplepie. I would like to be able
I'm very new to TDD world. I have a few questions regarding TDD. Do
I am very new to the world of byte encoding so please excuse me
I am new to the world of Javascript and am tinkering with writing very
I am very new to Visual Studio but i would like to use it
I'm new to PHP and having a problem reading checkboxes submitted by a form.
I'm new to php and mysql so this I'm sure is very simple! I
I am very new to php and mysql. I am trying to learn as
I'm creating a PHP script that imports some data from text files into a

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.