Continuing with form validation
After I have some usernames in my database I'd like to check the database to see if the username the user has chosen is available and not already in use by a current user.
My thoughts are to use PHP to gather values from the database and then use a PHP if / else statement to compare these values to the one the user has chosen and see if there are any matches.
The code I've got so far is below.
<form action = "insert_data.php" method = "post">
<input type = "text" name = "user_name">
<input type = "submit" value = "Submit">
$con = mysql_connect("host_address","database_name","password");
die('Could not connect: ' . mysql_error());
if ($_POST["user_name"] == any value in column "username" in the database)
echo "Username not available."
echo "Username available."