cara membuat Formulir Registrasi (Tanpa koneksi databse)
Pada postingan kali ini saya akan membahas Bagaimana cara membuat Formulir Registrasi (Tanpa koneksi databse). Formulir registrasi biasanya digunakan untuk mendata siswa, member, mahasiswa, ataupun yang lainnya. Pada formulir registrasi yang saya buat pada tutoral kali ini hampir sama, tapi belum dikoneksikan atau dihubungkan dengan database (phpmyadmin) ataupun yang lainnya.
Script PHP yang harus ada pada Formulir registrasi tersebut berjumlah 2 bagian, yaitu bagian input(formulir pengisian) dan bagian output(hasil dari pengisian).
Formulir pengisian :
<html>
<head>
<style type="text/css">
.register-form{
width: 470px;
margin: 0 auto;
text-align: center;
padding: 10px;
color: #fff;
background : lightblue;
border-radius: 10px;
-webkit-border-radius:10px;
-moz-border-radius:10px;
}
.register-form form input{padding: 5px;}
.register-form .btn{background: #FF000;
padding: 7px;
border-radius: 5px;
text-decoration: none;
width: 50px;
display: inline-block;
color: #FFF;}
</style>
<title> form fendi </title></head>
<body>
<center>
<div class="register-form"><h1>Formulir Pendaftaran</h1>
<table border=0>
<form method="post" action="hasil.php">
<tr><td>First name</td>
<td>: <Input TYPE=text name="firstname" size=50 MAXLENGTH=50 placeholder="First name" required></td></tr>
<tr><td>Last name</td>
<td>: <Input TYPE=text NAME="lastname" size=50 MAXLENGTH=50 placeholder="Last name" required></td></tr>
<tr><td> Email </td>
<td>: <input type=text name="email" size=50 MAXLENGTH=50 placeholder="Email" required></td></tr>
<tr><td> Kelamin </td>
<td>: <select name="kelamin">
<option>Jenis kelamin</option><option>Laki-laki</option><option>Perempuan</option></select></tr></td>
<tr><td> Kota </td>
<td>: <input type=text name="kota" size=50 MAXLENGTH=50 placeholder="Kota" required></td></tr>
<tr><td>Kode pos</td>
<td>: <Input TYPE=text NAME="kodepos" size=50 MAXLENGTH=50 placeholder="Kode pos" required></td></tr>
<td>Tanggal Lahir</td>
<td>
: <select name="tanggal">
<option>Tanggal</option><option>1</option><option>2</option><option>3</option><option>4</option><option>5</option><option>6</option>
<option>7</option><option>8</option><option>9</option><option>10</option><option>11</option><option>12</option>
<option>13</option><option>14</option><option>15</option><option>16</option><option>17</option><option>18</option>
<option>19</option><option>20</option><option>21</option><option>22</option><option>23</option><option>24</option>
<option>25</option><option>26</option><option>27</option><option>28</option><option>29</option><option>30</option>
<option>31</option>
</select>
<select name="bulan">
<option>Bulan</option><option>Januari</option><option>Februari</option><option>Maret</option><option>April</option>
<option>Mei</option><option>Juni</option><option>Juli</option><option>Agustus</option>
<option>September</option><option>Oktober</option><option>November</option><option>Desember</option>
</select>
<select name="tahun">
<option>Tahun</option><option>1980</option><option>1981</option><option>1982</option><option>1983</option><option>1984</option><option>1985</option>
<option>1986</option><option>1987</option><option>1988</option><option>1989</option><option>1990</option><option>1991</option>
<option>1992</option><option>1993</option><option>1994</option><option>1995</option><option>1996</option><option>1997</option>
<option>1998</option><option>1999</option><option>2000</option><option>2001</option><option>2002</option><option>2003</option>
<option>2004</option><option>2005</option><option>2006</option><option>2007</option><option>2008</option><option>2009</option>
<option>2010</option><option>2011</option><option>2012</option><option>2013</option><option>2014</option><option>2015</option></td>
</select>
<tr><td><br>
</table>
<input class="btn register" type="submit" name="submit" value="Daftar" >
<input class="btn register" type=reset value=reset data></td></tr></table><br>
</form>
</body>
</html>
Output(Hasil)
<html>
<head>
<style type="text/css">
.register-form{
width: 500px;
margin: 0 auto;
text-align: center;
padding: 10px;
color: #fff;
background : lightblue;
border-radius: 10px;
-webkit-border-radius:10px;
-moz-border-radius:10px;
}
.register-form form input{padding: 5px;}
.register-form .btn{background: #726E6E;
padding: 7px;
border-radius: 5px;
text-decoration: none;
width: 50px;
display: inline-block;
color: #FFF;}
.register-form .register{
border: 0;
width: 60px;
padding: 8px;
}
</style>
<title> form fendi </title></head>
<body>
<center>
<table border=3>
<div class="register-form"><h1>Selamat anda sudah terdaftar</h1></div><br>
<form method="post" action="input.php">
<tr><td>First name</td>
<td><?php echo $_POST["firstname"]; ?></td></tr>
<tr><td>Last name</td>
<td><?php echo $_POST["lastname"]; ?></td></tr>
<tr><td> Email </td>
<td><?php echo $_POST["email"]; ?></td></tr>
<tr><td> Kelamin </td>
<td><?php echo $_POST["kelamin"]; ?></td></tr>
<tr><td> Kota </td>
<td><?php echo $_POST["kota"]; ?></td></tr>
<tr><td>Kode pos</td>
<td><?php echo $_POST["kodepos"]; ?></td></tr>
<tr><td>Tanggal Lahir</td>
<td>
<?php echo $_POST["tanggal"]; ?> - <?php echo $_POST["bulan"]; ?> - <?php echo $_POST["tahun"]; ?></td></tr>
</table>
<br><input type="submit" name="submit" value="Back" >
</form>
</body>
</html>
Klik link ini untu melihat proses dan cara kerja PHP :