PHP Sessions

Posted on 2009-07-04
Medium Priority
Last Modified: 2012-05-07
Hi all I need to record into a session a value passed by a form to the same page. It' like this I need to fill a form and call the same page recording all the values in a session. How should I go about it?
Question by:doRodrigo
1 Comment

Accepted Solution

yauhing earned 2000 total points
ID: 24778696
Please try below example:

If value "name" was found in the $_POST, it will be added to the session.
session_start(); // start the session
	// if the name post from previous page, set it to the session
	$_SESSION['name'] = $_POST['name'];
Existing Session:
	// print out the session value
Input form for test:<br>
<form method="post">
Name: <input type="text" name="name" value="Test Name">
<input type="submit">

Open in new window


Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

597 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question