Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function registerform()
- {
- error_reporting(E_ALL);
- ini_set('display_errors','on');
- echo "<h1>Registration Form:</h1>\n\n"; // Form name <h1>
- echo "<form name='registration' action='"; $php_self; echo "' method='post'>\n"; // Builds the html form
- echo "<table class='formtable'>"; // Starts the beggining of the table
- username(); // Calls the username function creating part of the table
- //password(); // Calls the password function creating part of the table
- //firstname(); // Calls the firstname function creating part of the table
- //lastname(); // Calls the lastname function creating part of the table//
- //dateofbirth(); // Calls the d.o.b function creating part of the table
- //email(); // Calls the email function creating part of the table
- //gender(); // Calls the gender function creating part of the table
- //question(); // Calls the question function creating part of the table
- echo "<tr>\n<td>\n</td>\n";
- echo "<td><input type='submit' value='Register'> <input type='reset' value='Reset'></td>\n</tr>\n</table></form>";
- // Creates submit button and reset button, and also closes the form and table tabs
- }
- function username() {
- if($_SERVER['REQUEST_METHOD'] == 'GET') {
- echo "<tr>\n";
- echo "<td>Username:</p></td>\n";
- echo "<td><input type='text' name='username' value=''>";
- }
- elseif($_SERVER['REQUEST_METHOD'] == 'POST') {
- $username = $_POST['username'];
- if(!(isset($username) && (strlen($username) > 2) && (strlen($username) < 20) && (ctype_alpha($username)))) {
- echo "<tr>\n";
- echo "<td>Username:</p></td>\n";
- echo "<td><input type='text' name='username' value=''>";
- echo "<br>Username needs to be over 2 letters long and can only contain the letters A-Z'";
- }
- else {
- $_POST['username'];
- }
- }
- }
- function password() {
- $pass1 = $_GET['password1']; // Get password1 submitted from form
- $pass2 = $_GET['password2']; // Get password2 submitted from form
- echo "<tr>\n";
- echo "<td>Password:</p></td>\n";
- echo "<td><input type='password' name='password1'></td>\n";
- echo "</tr>\n";
- echo "<tr>\n";
- echo "<td>Re-Type Password:</p></td>\n";
- echo "<td><input type='password' name='password2'>\n";
- echo "</td>\n</tr>\n";
- }
- function firstname() {
- $fname = $_GET['firstname']; // Get firstname submitted from form
- echo "<tr>\n";
- echo "<td>First Name:</p></td>\n";
- echo "<td><input type='text' name='firstname' value='" . $fname . "'>\n";
- echo "</td>\n</tr>\n";
- }
- function lastname() {
- $sname = $_GET['secondname']; // Get lastname submitted from form
- echo "<tr>\n";
- echo "<td>Second Name:</p></td>\n";
- echo "<td><input type='text' name='secondname' value='" . $sname . "'>\n";
- echo "</td>\n</tr>\n";
- }
- function dateofbirth() {
- echo "<tr>\n";
- echo "<td>Date of birth:\n</p></td>\n";
- echo "<td valign='top'>"; include("dob.php"); days(); echo " / "; month(); echo " / "; year();
- echo "</td>\n</tr>\n";
- }
- function email() {
- $email = $_GET['email']; // Get email address submitted from form
- echo "<tr>\n";
- echo "<td>Current Email:</p></td>\n";
- echo "<td><input type='text' name='email' size='25' value='" . $email . "'>\n";
- echo "</td>\n</tr>\n";
- }
- function gender() {
- echo "<tr>\n";
- echo "<td>Gender:</p></td>\n";
- echo "<td><select name='gender'>
- <option value='Male'>Male</option>
- <option value='Female'>Female</option
- </select>";
- echo "</td>\n</tr>\n";
- }
- function question() {
- $answer = $_GET['answer']; // Get answer submitted from form
- echo "<tr>\n";
- echo "<td>Secret Question:</p></td>\n";
- echo "<td><select name='question'>
- <option value='Favourite Pets Name?'>Favourite Pets Name</option>
- <option value='Name of School?'>Name of School</option>
- <option value='Place of birth?'>Place of Birth</option>
- <option value='Mothers Maiden Name?'>Mothers Maiden Name</option>
- </select>
- </td>";
- echo "</tr>\n";
- echo "<tr>\n";
- echo "<td>Secret Answer:</p></td>\n";
- echo "<td><input type='text' name='answer' size='25' value='" . $answer . "'>\n";
- echo "</td>\n</tr>\n";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement