<?php
session_start();
include("connection.php");
if(!$_SESSION['hello'])
{
echo "<script>window.location='registar.php'</script>";
}
$id=$_GET['id'];
$sql="select * from reg where rid=$id";
$sqlexcu=mysqli_query($dd,$sql);
$fetch=mysqli_fetch_array($sqlexcu);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<form name="f1" method="post" enctype="multipart/form-data">
<table border="1">
<tr>
<th colspan="2">My Profile</th>
</tr>
<tr>
<th>Name</th>
<td><input type="text" name="txtname" value="<?php echo $fetch['name']; ?>" /></td>
</tr>
<tr>
<th>User Name</th>
<td><input type="text" value="<?php echo $fetch['uname']; ?>" disabled="disabled"/></td>
</tr>
<tr>
<th>Email</th>
<td><input type="text" name="txtemail" value="<?php echo $fetch['uemail']; ?>" /></td>
</tr>
<tr>
<th>Mobile Number</th>
<td><input type="text" name="txtmono" value="<?php echo $fetch['phonenum']; ?>" /></td>
</tr>
<tr>
<th>Address</th>
<td><textarea name="txtadd"><?php echo $fetch['address']; ?></textarea></td>
</tr>
<tr>
<th>Postal Code</th>
<td><input type="text" name="txtcode" value="<?php echo $fetch['postcode']; ?>" /></td>
</tr>
<tr>
<th>About me</th>
<td><textarea name="txtabtme"> <?php echo $fetch['aboutme']; ?></textarea></td>
</tr>
<tr>
<th>Image</th>
<td> <input type="file" name="file" /></td>
</tr>
<tr>
<th>Password</th>
<td> <input type="password" name="txtpass" value="<?php echo $fetch['pass']; ?>" /></td>
</tr>
<tr>
<td colspan="2"> <center> <input type="submit" name="btnupdate" value="Update" /></center></td>
</tr>
</table>
</form>
<?php
if(isset($_POST['btnupdate']))
{
$txtname=$_POST['txtname'];
$txtemail=$_POST['txtemail'];
$txtmono=$_POST['txtmono'];
$txtadd=$_POST['txtadd'];
$txtcode=$_POST['txtcode'];
$txtabtme=$_POST['txtabtme'];
$f1=$_FILES['file']['name'];
$tmp=$_FILES['file']['tmp_name'];
$txtpass=$_POST['txtpass'];
if($f1)
{
$rand=rand(1,5000000);
$imag=$rand.$f1;
$path= "imag/".$imag;
move_uploaded_file($tmp,$path);
}
if($f1=="")
{
$update="update reg set name='$txtname',uemail='$txtemail',phonenum='$txtmono',address='$txtadd',postcode='$txtcode',aboutme='$txtabtme',pass='$txtpass' where rid=$id ";
}
else {
$update="update reg set name='$txtname',uemail='$txtemail',phonenum='$txtmono',address='$txtadd',postcode='$txtcode',aboutme='$txtabtme',pimage='$imag',pass='$txtpass' where rid=$id ";
}
$updateexcu=mysqli_query($dd,$update);
if(!$updateexcu)
{
echo mysql_error();
}
else {
echo "<script>window.location='profile.php'</script>";
}
}
?>
</body>
</html>
session_start();
include("connection.php");
if(!$_SESSION['hello'])
{
echo "<script>window.location='registar.php'</script>";
}
$id=$_GET['id'];
$sql="select * from reg where rid=$id";
$sqlexcu=mysqli_query($dd,$sql);
$fetch=mysqli_fetch_array($sqlexcu);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<form name="f1" method="post" enctype="multipart/form-data">
<table border="1">
<tr>
<th colspan="2">My Profile</th>
</tr>
<tr>
<th>Name</th>
<td><input type="text" name="txtname" value="<?php echo $fetch['name']; ?>" /></td>
</tr>
<tr>
<th>User Name</th>
<td><input type="text" value="<?php echo $fetch['uname']; ?>" disabled="disabled"/></td>
</tr>
<tr>
<th>Email</th>
<td><input type="text" name="txtemail" value="<?php echo $fetch['uemail']; ?>" /></td>
</tr>
<tr>
<th>Mobile Number</th>
<td><input type="text" name="txtmono" value="<?php echo $fetch['phonenum']; ?>" /></td>
</tr>
<tr>
<th>Address</th>
<td><textarea name="txtadd"><?php echo $fetch['address']; ?></textarea></td>
</tr>
<tr>
<th>Postal Code</th>
<td><input type="text" name="txtcode" value="<?php echo $fetch['postcode']; ?>" /></td>
</tr>
<tr>
<th>About me</th>
<td><textarea name="txtabtme"> <?php echo $fetch['aboutme']; ?></textarea></td>
</tr>
<tr>
<th>Image</th>
<td> <input type="file" name="file" /></td>
</tr>
<tr>
<th>Password</th>
<td> <input type="password" name="txtpass" value="<?php echo $fetch['pass']; ?>" /></td>
</tr>
<tr>
<td colspan="2"> <center> <input type="submit" name="btnupdate" value="Update" /></center></td>
</tr>
</table>
</form>
<?php
if(isset($_POST['btnupdate']))
{
$txtname=$_POST['txtname'];
$txtemail=$_POST['txtemail'];
$txtmono=$_POST['txtmono'];
$txtadd=$_POST['txtadd'];
$txtcode=$_POST['txtcode'];
$txtabtme=$_POST['txtabtme'];
$f1=$_FILES['file']['name'];
$tmp=$_FILES['file']['tmp_name'];
$txtpass=$_POST['txtpass'];
if($f1)
{
$rand=rand(1,5000000);
$imag=$rand.$f1;
$path= "imag/".$imag;
move_uploaded_file($tmp,$path);
}
if($f1=="")
{
$update="update reg set name='$txtname',uemail='$txtemail',phonenum='$txtmono',address='$txtadd',postcode='$txtcode',aboutme='$txtabtme',pass='$txtpass' where rid=$id ";
}
else {
$update="update reg set name='$txtname',uemail='$txtemail',phonenum='$txtmono',address='$txtadd',postcode='$txtcode',aboutme='$txtabtme',pimage='$imag',pass='$txtpass' where rid=$id ";
}
$updateexcu=mysqli_query($dd,$update);
if(!$updateexcu)
{
echo mysql_error();
}
else {
echo "<script>window.location='profile.php'</script>";
}
}
?>
</body>
</html>
No comments:
Post a Comment