close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Preserve Form POST Data Displaying Errors

Thread began 5/04/2016 10:48 am by TonyE | Last modified 5/11/2016 4:26 pm by Ray Borduin | 1224 views | 4 replies |

TonyE

Preserve Form POST Data Displaying Errors

I have a form that displays a group of drop-down lists using data from my MySQLi database for updating. My program edits the data and displays an error message for incorrect data. The program displays the error messages correctly. However, it displays the old data from the database rather than the incorrect data the user entered. I use your recordset code to query the database. However, I'm currently updating the database with my own SQL code and will use your update behavior once I solve this problem. My PHP code is attached. I can't believe how much time I've lost on this!

Sign in to reply to this post

Ray BorduinWebAssist

You would have to create the recordset after the update if you wanted it to have the updated values. Just move the code that updates the database above the recordset code or more the recordset below the update and I think it will give you the result you are looking for.

Sign in to reply to this post
Did this help? Tips are appreciated...

TonyE

Preserve Form POST Data Displaying Errors

Originally Said By: Ray Borduin
  You would have to create the recordset after the update if you wanted it to have the updated values. Just move the code that updates the database above the recordset code or more the recordset below the update and I think it will give you the result you are looking for.  


That didn't work. I only update the database if there are not any errors from my validations. It seems like what you're saying is update the database with incorrect data, them display it. I'm confused! I've attached my updated code with your suggestion of putting the update code BEFORE the recordset.

Sign in to reply to this post

Ray BorduinWebAssist

I see... you would probably have to save the entered values into session variables when validation fails so that you could repopulate the form with the previous values when they return to the page. Set the values to the session variables if they exist or use the defaults if they don't.

If you were using webassist validations from DataBridge this would be done for you by the validation scripts.

Sign in to reply to this post
Did this help? Tips are appreciated...

TonyE

Ray, I used a variation of your suggestion and it worked! I wrapped an if statement around my drop-down lists. If !isset($_POST[field]) display data from the database OR if isset($_POST[field]) display POST data. As usual, thanks so much for your superb assistance. I checked out DataBridge and will most definitely consider it.

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...