week13.php
This commit is contained in:
parent
b38f8b4923
commit
1e6e5e59e7
60
week13.php
60
week13.php
@ -1,60 +0,0 @@
|
||||
<?php
|
||||
//untuk register
|
||||
include "koneksi.php"; // untuk memanggil koneksi.php
|
||||
/*if (isset($_POST['umur']))
|
||||
$umur = $_POST['umur'];
|
||||
else $umur=0;
|
||||
if ($umur<17)
|
||||
{echo "Belum boleh buat KTP<br>";}
|
||||
else if ($umur>60)
|
||||
echo "Tidak perlu buat KTP<br>";
|
||||
else echo "Sudah boleh buat KTP<br>";
|
||||
if (isset($_POST['n']))
|
||||
$n = $_POST['n'];
|
||||
else $n=0;
|
||||
//cetak segitiga
|
||||
for($i=1;$i<=$n;$i++)
|
||||
{
|
||||
for ($j=1;$j<=$i;$j++)
|
||||
{
|
||||
echo "*";
|
||||
}
|
||||
echo("<br>");
|
||||
}*/
|
||||
if (isset($_POST['username']))
|
||||
$username = $_POST['username'];
|
||||
else $username='';
|
||||
if (isset($_POST['firstname']))
|
||||
$firstname = $_POST['firstname'];
|
||||
else $firstname='';
|
||||
if (isset($_POST['lastname']))
|
||||
$lastname = $_POST['lastname'];
|
||||
else $lastname='';
|
||||
if (isset($_POST['password']))
|
||||
$password = md5($_POST['password']);
|
||||
else $password='';
|
||||
|
||||
//insert data ke table user_error
|
||||
if ($username!='' || $firstname='' || $lastname='' || $password='')
|
||||
{
|
||||
$sql ="insert into user(username, firstname, lastname, password) values('$username', '$firstname', '$lastname','$password')";
|
||||
if (mysqli_query($conn,$sql)){
|
||||
echo "insert berhasil";}
|
||||
else echo "error:",mysqli_error($conn);
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
||||
<html>
|
||||
<body>
|
||||
<form method="POST">
|
||||
Username: <input type="text" name="username"><br>
|
||||
Firstname:<input type="text" name="firstname"><br>
|
||||
Lastname:<input type="text" name="lastname"><br>
|
||||
Password:<input type="text" name="password"><br>
|
||||
|
||||
<input type="submit">
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
x
Reference in New Issue
Block a user