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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T17:06:45+00:00 2026-06-01T17:06:45+00:00

Hello i´m trying to set info from a post method into a variable that

  • 0

Hello i´m trying to set info from a post method into a variable that sets a session named name the value that the user input. I get the following error:

Notice: Undefined index: name in F:\xampp\htdocs\Impossible game\index.php on line 18

This is line 18: $session = $_POST[‘name’];

<form action="ms1.php" method="POST">
Name <input type="text" name="name">
<input type="Submit" value="Begin">
</form>
<?php
$session = $_POST['name']; 
session_start();
$_SESSION['name'] = $session;

the previous error is gone and now this appears

Notice: Undefined variable: session in F:\xampp\htdocs\Impossible game\index.php on line 23 below is line 23

 $_SESSION['name'] = $session;
  • 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-01T17:06:47+00:00Added an answer on June 1, 2026 at 5:06 pm

    Below the code is commented but untested. Please let me know if their are any issues.

        <?php
        if(isset($_POST['name'])){           //if the post has been set
            $session = $_POST['name'];       // Store the session in the variable
            session_start();
            $_SESSION['name'] = $session;    // Store the name in a session for later use
    header("location:index.php");    // Redirect the user     ##UPDATE##
        }   else    {
            //if post has not been set, show the form
        ?>
        <form action="ms1.php" method="POST">
        Name <input type="text" name="name">
        <input type="Submit" value="Begin">
        </form>
        <?php
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

hello guys i am trying to print title from a set of urls in
Hello guys Im trying to set a max width and height so that when
I'm trying to set up a javascript front in that is consuming JSON from
I am trying to set a cookie from example.com so that it's only accessible
hello im trying to set custom errors. i got a form. actions to post.php
Hello people of stackoverflow. I have a problem. I'm trying to set up my
Hello I been trying to figure out how to set up ASP.Net forms authentication
Hello I am trying to get the user profile picture and then merge into
Hello I'm trying to set attributes for a viewcontroller nested inside a NSMutableArray, for
Hello guys. I trying set EditText to input only numbers and point ( .

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.