Client Side Things
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesClient Side Things

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
  #1  
Old September 4th, 2009, 03:41 PM
yamahabob yamahabob is offline
Registered User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: May 2009
Posts: 16 yamahabob User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 h 11 m 54 sec
Reputation Power: 0
How to keep from losing $_POST value

I have a form that a user picks an item they want to read a review on and how many items to list per page. Well the item $_POST['itemName'] and the quantity $_POST['itemsPerPage'] are being lost in the second page of items. I'm using some premade code to allow me let the user scroll page by page. And when the user goes to the second page after submitting the form, both of the values are lost. Is there a way to make them constant? Or a place in the code to put them to keep their memory from being freed?

If it helps and the code for call the next page is here:
PHP Code:
 $pagination.= "<a href=\"$targetpage?page=$next\"> next »</a>";
        else
            
$pagination.= "<span class=\"disabled\"> next »</span>";
        
$pagination.= "</div>\n"


Thanks in advance

Last edited by yamahabob : September 4th, 2009 at 11:59 PM.

Reply With Quote
  #2  
Old September 9th, 2009, 12:52 PM
jamestrowbridge jamestrowbridge is offline
Contributing User
Click here for more information.
 
Join Date: Jul 2008
Location: Cleveland, Ohio, USA
Posts: 411 jamestrowbridge User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 Days 18 h 54 m 24 sec
Reputation Power: 2
Use sessions.

Add this to the top of your code:

PHP Code:
<?php
//Start the session
session_start();
//Check if there are any POST variables set
if(isset($_POST)) {
//If there are POST variables set, then set a SESSION variable
//With the same key name
foreach($_POST as $key=>$value) {
$_SESSION[$key] = $value;
}
}
//Check if there are any SESSION variables set
if(isset($_SESSION)) {
//If there are SESSION variables set, then set a POST variable
//With the same key name, so you don't have to change your
//Existing code to reflect '$_SESSION' instead of '$_POST'
foreach($_SESSION as $key=>$value) {
$_POST[$key] = $value;
}
}
?>
__________________
Sir, a desire of knowledge is the natural feeling of mankind; and every human being, whose mind is not debauched, will be willing to give all that he has to get knowledge.

Reply With Quote
  #3  
Old September 14th, 2009, 09:05 PM
yamahabob yamahabob is offline
Registered User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: May 2009
Posts: 16 yamahabob User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 h 11 m 54 sec
Reputation Power: 0
Wow. I just found your response. I waited and never got one, and my email didn't notify me. This worked perfect!
Thanks so much!

Reply With Quote
  #4  
Old September 14th, 2009, 09:30 PM
jamestrowbridge jamestrowbridge is offline
Contributing User
Click here for more information.
 
Join Date: Jul 2008
Location: Cleveland, Ohio, USA
Posts: 411 jamestrowbridge User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 Days 18 h 54 m 24 sec
Reputation Power: 2
Glad to hear.

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesClient Side Things > How to keep from loosing $_POST value


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump




 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

Request Your Free Technology Downloads!
 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

Request Your Free Technology Downloads!
 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

Request Your Free Technology Downloads!
 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

Request Your Free Technology Downloads!
 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

Request Your Free Technology Downloads!
 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 




© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 5 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek