jamesnkk Posted March 21, 2006 Share Posted March 21, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/5393-how-do-display-error-message-after-form-is-posted/ Share on other sites More sharing options...
Humpty Posted March 21, 2006 Share Posted March 21, 2006 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 helpedI 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 :( Quote Link to comment https://forums.phpfreaks.com/topic/5393-how-do-display-error-message-after-form-is-posted/#findComment-19246 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.