There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Software Development
Tag Cloud
audio blue screen boot bsod computer cpu crash dell desktop driver drivers error excel external hard drive firefox freezes freezing hard drive hardware hijackthis internet internet explorer itunes laptop mac malware motherboard mouse network networking outlook 2007 power printer problem ram router screen slow sound trojan usb virus vista vista 32-bit windows windows vista windows xp winxp wireless wmp
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Software & Hardware > Software Development >
PHP Session Question


Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members. Enjoy!

Closed Thread
 
Thread Tools
Regicide's Avatar
Senior Member with 304 posts.
 
Join Date: Aug 2003
Experience: Advanced
26-Sep-2003, 08:21 PM #1
PHP Session Question
I know that there is a way to have sessions save data from the previous page. This is so when you press the "back" button on IE, the text in the textboxes will still be there. Does anyone know how to do this?
brendandonhu's Avatar
Distinguished Member with 15,988 posts.
 
Join Date: Jul 2002
Location: Ann Arbor, MI
Experience: Advanced
27-Sep-2003, 08:05 PM #2
PHP can only save the data if the form is submitted. But once the form field's value is in a variable, yes you can pre-populate a textbox with it.
If the person's name was in a session variable called NAME, you could use this for your textbox.

PHP Code:
<input type="text" name="name" value="<?php echo $_SESSION['NAME'?>">
__________________
-Brendan
deuce868's Avatar
Senior Member with 638 posts.
 
Join Date: Nov 2000
Location: MI
29-Sep-2003, 03:32 PM #3
there are actually several ways to do this. Session variables are generally forwned upon.

The way I get around them is that I have the form post to the same page it is on. I then detect if the submit button has been pressed with

if( isset($_POST['submit']) && $_POST['submit'] == "submit" ) {

This way all of my values from before are in the $_POST array on this page and if there is an error I can simply toss the values into and array and resue them on the same page. There is no need to use two pages to validate a form.
__________________
www.ricksweb.info
www.2webheads.com
Quote:
Techies just think a little differently...at least that's what they keep telling me.
Closed Thread

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.



Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 08:58 AM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.