Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > WebsitePainter
Registration

milanix
Registered User
Quote
2019-01-30 21:29:46

Below is the simplest registration code on php for those who need it.

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style>
* { font-family:arial; font-size:10pt;}
td, th {
padding: 18px;
td border: thin solid black;text-align: left;
}
</style>
</head>
<body>
<form action="registration.php" method="POST" />
<table>
<tr><td>*Surname</td><td>*Name</td><td>Patronymic</td><td>*Birthdate</td><td>*Login</td><td>*Password</td><td>*Email</td><td>*Phone</td>
<tr><td><input type="text" size="20" name="Surname"/></td><td><input type="text" size="20" name="Name"/></td><td><input type="text" size="20" name="Patronymic"/></td><td><input type="text" size="20" name="Birthdate"/></td><td><input type="text" size="20" name="Login"/></td><td><input type="Password" size="20" maxlength="20" name="Password"/></td><td><input type="text" size="20" name="Email"/></td><td><input type="text" size="20" name="Phone"/></td></tr>
<tr>
<td colspan="2"><input class="button" type="submit" value="To register" name="submit" /></td>
</tr>
</table>
</form>
<?php
$connection = mysqli_connect('host', 'user', 'password', 'db') or die(mysqli_error($connection));
if (isset($_POST['submit']))
{
if (empty($_POST['Surname']))
{
$info_reg = 'You did not enter a surname';
}
elseif (empty($_POST['Name']))
{
$info_reg = 'You have not entered a name';
}
elseif (empty($_POST['Birthdate']))
{
$info_reg = 'You did not enter a birthdate';
}
elseif (empty($_POST['Login']))
{
$info_reg = 'You have not entered a login';
}
elseif (empty($_POST['Password']))
{
$info_reg = 'You have not entered a password';
}
elseif (empty($_POST['Phone']))
{
$info_reg = 'You have not entered a mobile phone';
}
elseif (empty($_POST['Email']))
{
$info_reg = 'You did not enter the mail';
}
else
{
$Surname = $_POST['Surname'];
$Name = $_POST['Name'];
$Patronymic = $_POST['Patronymic'];
$Birthdate = $_POST['Birthdate'];
$Login = $_POST['Login'];
$Password = $_POST['Password'];
$Phone = $_POST['Phone'];
$Email = $_POST['Email'];
$query = "INSERT INTO `Reg` (Surname, Name, Patronymic, Birthdate, Login, Password, Phone, Email)
VALUES ('$Surname', '$Name', '$Patronymic', '$Birthdate', '$Login', '$Password', '$Phone', '$Email')";
$result = mysqli_query($connection, $query) or die(mysqli_error($connection));
$info_reg = '<div style="position:absolute; left:15%">Registration successful</div>';
}
}
$info_reg = isset($info_reg) ? $info_reg : NULL;
echo $info_reg;
?>
</body>
</html>


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "Inter?ational" (you are not logged in)


Text:

 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


   






Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact