Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Retaining form variables across multiple pages
Old 05-31-2009, 03:06 PM Retaining form variables across multiple pages
Novice Talker

Posts: 10
Trades: 0
Simple Version: Hey, I have about three pages that I want to use to retain variables that were submitted from a form on the first page. How will I go about doing this?

In-Depth Version: I have three pages that I need to be able to retain form information that was submitted from the first page so that when somebody who did not originally submit the first form won't be able to access the rest of the pages unless they have the original form data stored in their session.

Here is my page setup:

Page 1: Admin login page (with the form to be processed)
Page 2: (login.php) - Processes the form and displays a news form that allows the logged-in admin to post news to the website, only if the username and password they entered matches the values I have stored.
Page 3: The result of the news form submition. Basically, a page listing the news postings from the database.

However, I have two different Page 3's (news.php and newsadmin.php). One is a regular page listing all of the news postings (a public version, if you will) and the other is an admin page that has "Delete" icons next to each news posting, letting the admin delete the items from the database but within the website.

What I want is to have it so that any public user will NOT be able to access the admin version of Page 3, unless they were originally logged in from Page 1.

I've tried messing around with storing session variables, but I'm not sure if I've been doing it correctly. Any help is appreciated.
casual-t is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 06-02-2009, 02:34 PM Re: Retaining form variables across multiple pages
Extreme Talker

Posts: 181
Name: David Jackson
Trades: 0
just assign the form data to a session on submission

PHP Code:
$_SESSION['formArray'] = $_POST
__________________

Please login or register to view this content. Registration is FREE

Last edited by davidj; 06-02-2009 at 02:36 PM..
davidj is offline
Reply With Quote
View Public Profile
 
Old 06-02-2009, 05:06 PM Re: Retaining form variables across multiple pages
maxxximus's Avatar
Extreme Talker

Posts: 219
Name: Rob
Location: UK
Trades: 0
User authentication - lots of tutorials out there http://www.php-mysql-tutorial.com/wi...ntication.aspx.

Login page sets a session variable if log in is successful. Any page to which public access should be restricted would need a routine to check for this session variable and redirect if not present.
maxxximus is offline
Reply With Quote
View Public Profile
 
Old 06-02-2009, 07:12 PM Re: Retaining form variables across multiple pages
Novice Talker

Posts: 10
Trades: 0
Thanks, I'll try your suggestions. I did some googling before, but couldn't find exactly what I was looking for hence why I made this thread, but I shall try that tutorial.
casual-t is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Retaining form variables across multiple pages
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.15813 seconds with 12 queries