Customizing the Signup Form
In this tutorial we will show you how to add additional fields to the signup object of the login tools.
This tutorial assumes that you have knowledge of PHP and MySQL. This method does not work for the text based database, because the structure of that database cannot be changed.
Before you can add addtional field to the signup form you will need to the create additional fields in the MySQL database.
So first let's login to phpMyAdmin and create those new fields. The following fields will be added:
We can use the following SQL statement to insert the fileds to the database:
(Note that the other fields were already created by the SQL script from the help!)
ALTER TABLE `USERS` ADD `address` VARCHAR( 100 ) NOT NULL ,
ADD `city` VARCHAR( 100 ) NOT NULL ,
ADD `code` VARCHAR( 10 ) NOT NULL ,
ADD `phone` VARCHAR( 25 ) NOT NULL ,
ADD `state` VARCHAR( 25 ) NOT NULL ;
Right click the signup form and select 'Convert to form' from the context menu.
This will convert the static signup form into native Web builder objects so you can fully customize the layout and code as you like.
Your page will now have a form and an HTML object with the form processing code.
Modify the script, so the new fields will also be stored in the database.
Double click the <HTML> - Signup object to edit the script.
$newfullname = $_POST['fullname'];
insert the variables for the new fields. Note that in this example we did not implement any input validation. You can add that later if you wish.
// extra fields
$address = $_POST['address'];
$city = $_POST['city'];
$code = $_POST['code'];
$phone = $_POST['phone'];
$state = $_POST['state'];
And finally modify the SQL statement:
$sql = "INSERT `".$mysql_table."` (`username`, `password`, `fullname`, `email`, `active`, `address`, `city`, `code`, `phone`, `state`) VALUES ('$newusername', '$crypt_pass', '$newfullname', '$newemail', 1, '$address', '$city', '$code', '$phone', '$state')";
Publish the page to test the new form/script.
Add the extra fields to form. The easiest way to do this to copy/paste one of the existing fields so you the objects will have the same style. Don't forget to change the ID and Name of each field. In this example these are named them 'address', 'city', 'code', 'state' and 'phone'.