close ad
WARNING PC USERS: Do Not Install the DREAMWEAVER CC 2017 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

How to add a POST value after Update?

Thread began 3/09/2016 1:28 pm by LionsMane | Last modified 3/10/2016 5:03 pm by Ray Borduin | 141 views | 8 replies |

LionsMane

How to add a POST value after Update?

I have a page where a mySQLi recordset is retrieved based on a uniqueID passed via form POST. This works fine. Then I have another page where a mySQLi UPDATE updates a row, and then redirects back to this first page... but obviously the recordset on the first page now will be blank, because there's no POSTed uniqueID. How can I pass this same POST value from the Update page so the recordset populates again?

Sign in to reply to this post

Ray BorduinWebAssist

You can't easily post a value in a redirect. It is probably better to use a url parameter and a $_GET, or you could store the $_POST value in the session and use the session when they return to the page.

Sign in to reply to this post

LionsMane

That's part of the issue, sorry I left it out. For privacy reasons, we can't have the uniqueID showing in the URL, so the GET method is out. I would use a Session variable, except that the page we're returning to is building their first recordset based on a POST, not a session variable, and (to the best of my knowledge) we can't build that recordset on EITHER a POST or a SESSION... unless you know of a different method of passing an ID without showing it in the URL?

Sign in to reply to this post

Ray BorduinWebAssist

Just save the post into the session on the original page and build the recordset based on the session always.

Sign in to reply to this post

LionsMane

Yeah, I would totally do that.. EXCEPT that the page building the recordset based on the original POST value is being referred to from a previous page with a dynamically built list of records. I can assign the uniqueID of each of those records to a POST value so regardless of how many records there are, each will POST with their own uniqueID to the secondary page for editing. Because that list is dynamic, I can't hard-assign a Session variable to each record. Make sense? Or can I???

Better description of flow:
Page A has a database delivered dynamic list of Customers, each with it's own uniqueID.
A form exists for each record in this list, allowing us to POST that uniqueID to Page B without showing the ID in the URL.
Page B retrieves the record based on the uniqueID in the POST value, and populates the Update form values.
Page B also has a dynamic list of Users for each Customer, with it's own form to POST a UserID to an Update page to change user record on Page C.
User Submits the UPDATE on Page C to update the User record, and is redirected back to Page B.
Page B fails to load the dynamic list, because it's missing the POST value from Page A.
...clear as mud??

Sign in to reply to this post

Ray BorduinWebAssist

You should still be able to store the session variable based on the posted value and then use that to filter the recordset just like you do with the posted variable now. The only difference is that when you return it will keep on the previously viewed record automatically because it is stored in the session.

Sign in to reply to this post

LionsMane

I get that, but there's a hitch in that logic.. when I return to Page B from the UPDATE on Page C, the POST value from Page A is obviously absent, so the code that assigns the session variable fails to load any value, like it's clearing out that session variable (value is not being held from the previous visit/assignemnt). Content is blank.

Sign in to reply to this post

Ray BorduinWebAssist

Only store the session variable value IF the posted value exists:

@session_start();
if (isset($_POST['postval'])) {
$_SESSION['postval'] = $_POST['postval'];
}

That way it will reset the session variable if there is a value posted to it and won't touch the existing one if you return to the page without the post.

Sign in to reply to this post

LionsMane

I was just thinking the same thing. Thanks so much for the extra lobes.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...