When visitors register on my site, they will do so as the founding member of a group or as a person joining an existing group. Nobody is "group-less." I have a single registration page with the following fields: first name, last name, (radio buttons to choose group type: New or Existing), group name, group password, email, pass, confirm pass. I'm concerned specifically with the radio buttons, group name, and group password.
The specific function I'm looking for is this:
If "New" is selected, AJAX checks if group name exists in database, displays either "Good" or "Already taken." ALSO: when form is submitted, password saved to database.
If "Existing" is selected, AJAX checks if group name exists in db, displays either "Matched" or "Non-existent." ALSO: when form is submitted, password checked against database.
Ben bir kolu olduğunu düşünüyorum, ama ne kadar çok dikte radyo düğmesini almak için bu temelleri beni dışındadır. Herhangi bir yardım mutluluk duyacağız.
Aşağıda benim php dosya biçimidir parçasıdır. (Bu arada, ben bu proje için mysqli yazıyorum.)
<h1>Register</h1>
<form action="register.php" method="post">
<fieldset>
<p><b>First Name:</b> <input type="text" name="first_name" size="20" maxlength="20" value="<?php if (isset($trimmed['first_name'])) echo $trimmed['first_name']; ?>" /></p>
<p><b>Last Name:</b> <input type="text" name="last_name" size="20" maxlength="40" value="<?php if (isset($trimmed['last_name'])) echo $trimmed['last_name']; ?>" /></p>
<p><b>Are you registering a new group or joining an existing group?</b> <br />
New:<input type="radio" value="new" name="gtype">
Existing:<input type="radio" value="existing" name="gtype"> </p>
<p><b>Group ID:</b> <input type="text" name="group_id" size="20" maxlength="40" value="<?php if (isset($trimmed['group_id'])) echo $trimmed['group_id']; ?>" /></p>
<p><b>Group Password:</b> <input type="password" name="gpass" size="8" maxlength="5" />
<small>Use only numbers. Must be 5 digits long.</small></p>
<p><b>Email Address:</b>
<input type="text" name="email" size="30" maxlength="80" value="<?php if (isset($trimmed['email'])) echo $trimmed['email']; ?>" onBlur='checkEmail(this)'/><span id='info'></span></p>
<p><b>User Password:</b>
<input type="password" name="password1" size="8" maxlength="4" />
<small>Use only numbers. Must be 4 digits long.</small></p>
<p><b>Confirm Password:</b> <input type="password" name="password2" size="4" maxlength="4" /></p>
</fieldset>
<div align="center"><input type="submit" name="submit" value="Register" /></div>
<input type="hidden" name="submitted" value="TRUE" />
</form>