Jump to content


How do Display error message after form is posted

  • Please log in to reply
1 reply to this topic

#1 jamesnkk

  • Members
  • PipPip
  • Member
  • 21 posts

Posted 21 March 2006 - 04:11 AM

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.

#2 Humpty

  • Members
  • PipPipPip
  • Advanced Member
  • 132 posts

Posted 21 March 2006 - 06:17 AM

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 :(
- Humpty
  #> Where does the light go when it goes out?

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users