joined:Apr 1, 2005
I'm trying to validate user input into a form by using PHP. The data entered into the fields will be put into a MySql database. And I read this on the W3school's website.
"You should consider server validation if the user input will be inserted into a database. A good way to validate a form on the server is to post the form to itself, instead of jumping to a different page. The user will then get the error messages on the same page as the form. This makes it easier to discover the error."
So I'm trying to post the form to itself and see what the page looks like with both the form and a message on it.
But I'm not having any luck. Below is the code I'm using.
<form action="display_field.php" method="post">
Username: <input type="text" name="user_name">
<input type="submit" value="Submit" onClick="display_field()">