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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T21:34:09+00:00 2026-05-12T21:34:09+00:00

im new to sessions but from what i see it complicated to apply <input>

  • 0

im new to sessions but from what i see it complicated to apply <input> with them. can you please look at this code and tell me why its not working. i had it working earlier then it died on me. the function of the program is to fill out a form and have it verified for legit information using regular expressions, i just need help with getting the sessions to save the data.

<?php session_start(); ?> 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>regex</title>


</head>

<body>

<?php

$fname = $_REQUEST['fname'];

$fname = $_SESSION['fname'];


print<<<form

<form method="post"  action="">

  <input type ="text"
             name="fname"
             value="">

    <input type ="submit">

</form>

form;

$_SESSION['fname'] = $fname;

 print $_SESSION['fname'];


?>

</body>
</html>
  • 1 1 Answer
  • 1 View
  • 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-05-12T21:34:09+00:00Added an answer on May 12, 2026 at 9:34 pm

    Timothy,
    Change your code so that it checks if the session/request is empty or not

    Something like:

    if(isset($_REQUEST['fname'])){
      $fname = $_REQUEST['fname'];
    }else if(isset($_SESSION['fname'])){
      $fname = $_SESSION['fname'];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm playing with small exercise to understand sessions and posts, but can't get them
I am new to sessions, and think I get the basics of them, they
Does anybody try zf2? I can not understand new mechanism of using sessions in
Came across this code: <?php require_once 'HTTP/Session/Container/DB.php'; $s = new HTTP_Session_Container_DB('mysql://user:password@localhost/db'); ini_get('session.auto_start') or session_start();
I recently updated to the new version of XCode and the session start code
I have a website which is behaving oddly in terms of creating new sessions.
I know this isn't strictly a programming question but y'all must have experienced this.
I'm using Zend Framework for PHP and handling sessions with the Zend_Session module. This
I'm new to NHibernate (+Fluent), and I can't decide on what's the best strategy
I'd like to persist pidl s between sessions, so that my application can remember

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.