Usercheck.php Script Request
I am looking for a script to check my database to see if a username is already in use. I am new to PHP so talk to me like I am 10 (even though a ten year old can probably program better than me). I just want to check the database and return a true or false based on a variable that is entered in my form below. Also, I want to use an AJAX request to make this happen so I don't know if that matters. Also I am using SQL Buddy.
<p><form action="/signup/register.php" method="post">
<label for="first_name">First Name</label>
<input type="text" name="first_name" />
<label for="last_name">Last Name</label>
<input type="text" name="last_name" />
<label for="company">Company</label>
<input type="text" name="company" />
<label for="job_title">Job Title</label>
<input type="text" name="job_title" />
<label for="phone">Phone</label>
<input type="text" name="phone" />
<label for="email">Email</label>
<input type="text" name="email" />
<label for="username">Choose a Us开发者_JAVA技巧ername</label>
<input type="text" name="username" />
<label for="password">Choose a Password</label>
<input type="text" name="password" />
<label for="confirm_password">Confirm Your Password</label>
<input type="text" name="confirm_password" />
<input type="submit" value="Get Started" />
</form>
This is one of the things php is good for.
Since you say you are beginner programmer I'm going to point you to a basic tutorial on checking Databases with sql:
HP 101 (part 8): Databases and Other Animals - Part 1
This tutorial covers all you need:
- A little SQL
- MySQL connection
- Integration with a form.
In general all the PHP 101 series is really good for beginners.
If you prefer a more detailed coverage of the topic then: PHP and MySQL Web Development (4th Edition) is the best beginners book. IMO
精彩评论