General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old May 16th, 2003, 06:29 PM
muiz muiz is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2003
Posts: 2 muiz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
passing $_POST among pages

I'm designing a database app (PHP and MySQL) and am using HTML forms to collect the data. I want to present a data confirmation page (field names and data, but without the form field entry boxes) to the user before adding the data to the database.

The user will either confirm the data, at which point it is added to the database, or will choose to edit the data and is taken back to the original form page, which displays the previously entered data.

No problem posting the data directly from the form to the database, nor dispalying the form data on the confirmation page, via echoing the values from the $_POST array, but I'm stumped trying to figure how to pass the existing $_POST array either back to the original form (where the 'value=' attributes of the input tags will display what was entered), or on to the database, now that I've got the confirmation page in the middle of the process.

The confirmation page design is a second form with POST and EDIT submit buttons, which is the source of the problem with this design, since no fields exist to get loaded into $_POST on submission.

Is there a way to make the key value pairs in $_POST persist, or to load them into the new $_POST that the second from generates? Or is there a better approach altogether?

Thanks,

Muiz

Reply With Quote
  #2  
Old May 16th, 2003, 09:07 PM
muiz muiz is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2003
Posts: 2 muiz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
update: passing $_POST

Since posting my question, I realized that my data confirmation page form needed hidden fields containing the values in $_POST passed to it by the original data entry form, so that there would be data to post when the confirmation page is submitted.

Posting to the database from the secondary page now works, but reloading the original page, with previously entered data, so the user can correct mistakes still doesn't work.

I'm using a variable ($submitFormAction) as my form action= attribute, set to $PHP_SELF, so that an IF statement at the top of the confirmation page is triggered to decide whether to insert the record into the database, or reload the original data entry page for corrections ...

----------------PHP Code--------------------------------------------------

if ($_POST['submit'] == 'EditData') {
// don't post, go back to Add page to edit data
$validGoTo = 'addSubscriber.php';
header(sprintf("Location: %s", $validGoTo));
exit(); // tried commenting this line, but doesn't change it

} elseif ($_POST['submit'] == 'AddSubscriber') {
// load MySQL vars and insert into database
.... this segment works
}
--------------------------------------------------------------------------------

The first segment of the IF statement above correctly loads the 'addSubscriber.php' page, but without the $_POST array, so that all of the value='$_POST['fieldname']' field attributes for the addSubscriber form are empty.

PHPinfo() indicates that the GET method is being used, rather than POST, even though POST is the method in the form on the confirmation page.

Any ideas how I can guarantee a POST server method, or force it?

Thanks,

Muiz

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > passing $_POST among pages


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


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





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway