-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsignup.php
41 lines (33 loc) · 1.1 KB
/
signup.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
$dbhost="localhost";
$dbuser="root";
$dbpass="";
$dbname="login";
$mysql= new mysqli($dbhost,$dbuser,$dbpass,$dbname);
if($mysql->connect_error){
echo "Connection Un-Successfull";
exit();
}
$name=$_POST['Name'];
$email=$_POST['email'];
$address=$_POST['address'];
$phone=$_POST['phone'];
$password=$_POST['password'];
try {
$sql="insert into users (Name,Email,Address,Phone,password) value ('$name','$email','$address','$phone','$password')";
if($mysql->query ($sql)){
$message = "Regitered SuccessFully";
$loginLink = "register.php";
echo "<script>alert('$message'); window.location.href = '$loginLink';</script>";
}else{
$message = "Registration UnsuccessFull";;
$loginLink = "register.php";
echo "<script>alert('$message'); window.location.href = '$loginLink';</script>";
}
}
catch (Exception $e) {
$message = "Registration UnsuccessFull ... Email Address Already Taken";;
$loginLink = "register.php";
echo "<script>alert('$message'); window.location.href = '$loginLink';</script>";
}
?>