-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
editprofile.php
56 lines (50 loc) · 1.61 KB
/
editprofile.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
<?php
include 'include/db_config.php';
include 'include/cookies_config.php';
include 'include/session_config.php';
include 'include/header.php';
//user data
$result = mysql_query("SELECT * FROM profile where profileid=".$_SESSION['id']);
$user = mysql_fetch_array($result);
if (isset($_POST['change'])) {
if ($_POST['username']=='') $username=$user['username'];
else $username = $_POST['username'];
if ($_POST['contactno']=='') $contactno = $user['contactno'];
else $contactno=$_POST['contactno'];
$gender = $_POST['gender'];
if(mysql_query("UPDATE profile SET username='$username',contactno='$contactno',gender='$gender' where profileid=".$_SESSION['id'])){
echo "<script>alert('Successful');</script>";
header("Location: editprofile.php");
}
else{
echo "<script>alert('Somthing Missing !!!');</script>";
}
}
echo '
<div class="setting">
<form method="post">
<h2>Update Your Profile</h2>
<h3>User Name:<strong>'.$user['username'].'</strong></h3>
<input type="text" name="username" placeholder="New User Name"/>
<h3>Contect No.:<strong>'.$user['contactno'].'</strong></h3>
<input type="text" name="contactno" placeholder="New Mobile No"/>';
if($user['gender']=='m'){
echo '
<h3>Gender:<strong>Male</strong></h3>
<select name="gender">
<option value="m" selected>Male</option>
<option value="f"> Female</option>
</select> ';}
else{echo '
<h3>Gender:<strong>Female</strong></h3>
<select name="gender">
<option value="m">Male</option>
<option value="f" selected> Female</option>
</select> ';}
echo '<center>
<button type="submit" name="change">Change</button>
</form>
</div>
';
include 'include/footer.php';
?>