Jump to content

Archived

This topic is now archived and is closed to further replies.

jamesnkk

How do Display error message after form is posted

Recommended Posts

Is it possible in PHP, where the user filled up the entry form and click the submit button, which use the 2nd form to query from the table to see if data is duplicate, if data is not duplicate then update into the table,

but if duplicate it re-driect back to the form where the previous text entry still displayed on the form and then indicate an error message on the form. I tried use header to return to the form, but all the text entry is empty and I can't display error message. Please help.

Share this post


Link to post
Share on other sites
I think you'd be best served by making the page submit to itself and then using and IF statement to determine if you need to dispplay that info again for correction or if you should printout a message stating that the data is succuscully entered into the database.

One of the more straight forward and easy to understand ways of doing this is to have a hidden text field (example hidden1) that has a value of for example "secondpass"

When the page loads use an IF to check if hidden1 = "secondpass"

hidden1 will only = secondpass if someone clicks on the submit button, meaning that you will know if the page was loaded from a link (hidden1 = "" or null) or was submitted (hidden1 = "secondpass")

hope that helped
I like to help but sometimes I'm wrong or there is a better way and other times I'm a little vague / hard to follow :(

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.