Q: He I need answer about Connection html registration Form into database system. Is It possible or not ?
Please answer me I need fast answer.
Ans: Yes you can connect your html registration into a database system by creating a .php file. Here are the instructions:
1. Design your registration form using html, begin with the standard heading and include the form tag. Additionally, don't forget to include also the attribute name of every text/combobox/radiobutton/listbox. See sample below…
<form method ="post" action="reg.php">
<label>Name:</label><input type="text" name="name" id="name' size ="50" maxlength="50"/> //text box for name
2. Create a database in your local computer or web server (ex. registration). Add new table with corresponding fields required in your form (ex. regtable with a field named name). Add new user, set the username, password and add privileges (create, delete, add, alter).
3. If you would notice the form tag in step 1, I used reg.php for action attribute. In this case, you are going to create a new reg.php file.
Begin with standard format of .php file using <?php and ends with ?>.
First, you must create a connection to your database, mysql_connect function was used, inside that include parameters such as your server, username, password set to use the database.
Second, call the elements in your html form then assign that to a variable to store data temporarily.
Third, Select the database.
Fourth, Insert records to the table
Lastly, check if the record was successfully stored in database.
See complete sample code below.
$link = mysql_connect("localhost", "rapuyot, "12345") or die ("Could not connect.:". mysql_error()); //rapuyot is the username, 12345 is the password.
$DB = "registration"; //registration is the database name
$table = "regtable"; //regtable is the table name
$name = $_POST["name"]; //["name"] -> name attribute of text box name in your html form.
mysql_select_db($DB) or die ("Database $DB not select…" .mysql_error()0;
$query = "INSERT INTO $table (Name, ……., ……. , ……..) VALUES ('$name', '$……', '$……', '$……')"; //name is the field in table named regtable.
if(! mysql_query ($query, $link)) die ("MySQL error…<p>" . mysql_error());
print"<p> Successfully data added to table: $table";
4. Check your database if the records were successfully added into the table.