forked from mirza9252/CURD
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcreate.php
83 lines (77 loc) · 2.49 KB
/
create.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?php
if (isset($_POST['save'])) {
//include database configuration
include 'db_connect.php';
// extract($_REQUEST);
// $id = $_POST['id'];
$name = $_POST['name'];
$age = $_POST['age'];
$sex = $_POST['sex'];
$email = $_POST['email'];
$password = md5($_POST ['password']);
//$password = md5(strip_tags($_POST['password']));
//sql insert statement
$sql = "insert into user_profile SET name='$name', age='$age', sex='$sex', email='$email', password='$password'";
$query = mysql_query($sql) or die(mysql_error());
//insert query to the database
if ($query) {
//if successful query
echo "New record was saved.";
}
}
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" >
<title>Create an User Profile</title>
<style type="text/css">
.s{
color: red;
}
</style>
</head>
<body>
<a href="index.php">Back to Main page</a>
<br />
<!-- Information for the profile -->
<form action='#' method='post'>
<table>
<!-- <tr>
<td>Id</td>
<td><input type='number' name='id' /></td>
</tr>-->
<tr>
<td>Name</td>
<td><input type='text' name='name' /></td>
</tr>
<tr>
<td>Age</td>
<td><input type='text' name='age' /></td>
</tr>
<tr>
<td>Sex</td>
<td><input type='text' name='sex' /></td>
</tr>
<tr>
<td>Email</td>
<td><input type='text' name='email' /></td>
</tr>
<tr>
<td>Password</td>
<td><input type='text' name='password' /></td>
</tr>
<!-- <tr>
<td>Create Date</td>
<td><input type='date' name='create_date' /></td>
</tr>-->
<tr>
<td>
<input type='submit' value='Save' name="save" />
</td>
</tr>
</table>
</form>
<!--<button " onclick="location.href = 'http://localhost/profile/index.php'">Back To Main Page</button><br/>-->
</body>
</html>