Simple Project(part-3d)
editMyprofile.php
editProfile_action.php
<?php
include("connect.php");
// get value of id that sent from address bar
$id=$_REQUEST['id'];
// retrive data from database
$query=mysql_query("select * from create_profile where id='$id'");
$dataPacket=mysql_fetch_array($query);
?>
<form name="userUpdateProfile" method="post"
action="editProfile_action.php">
<center>
<div ><h3>Create Profile</h3>
<div>Name:
<input name="userName" type="text" value="<?php echo $dataPacket['userName']; ?>"id="Name"/>*
</div>
</br>
<div>Father's Name:
<input name="userfatherName" type="text"
value="<?php echo $dataPacket['userfatherName'];?>" id="fatherName">*
</div>
</br>
<div>Occupation:
<input name="userOccupation" type="text"
value="<?php echo $dataPacket['userOccupation']; ?>"
id="Occupation">*
</div>
</br>
<div>Nationality:
<input name="userNationality" type="text"
value="<?php echo $dataPacket['userNationality']; ?>"
id="Nationality">*
</div>
</br>
<div>Religion:
<input name="userReligion"
type="text" value="<?php echo $dataPacket['userReligion']; ?>" id="Religion">*
</div>
</br>
<div>Address:
<textarea rows="10" cols="35" name="userAddress">
</textarea>
</div>
</br>
<div>Designation:
<input name="userDesignation" type="text"
value="<?php echo $dataPacket['userDesignation']; ?>"
id="Designation">*
</div>
</br>
<div>Country:
<?php $query="SELECT COUNTRY_ID, COUNTRY
from countrys where ISACTIVE=1 ORDER BY COUNTRY";
$result=mysql_query($query);
?>
<select name="country" >
<option value="" >Select a country</option>
<?php
while($country =mysql_fetch_array($result))
{
?>
<option value="<?php echo $country['COUNTRY_ID'];?>" <?php if($country['COUNTRY_ID']==$dataPacket['country'])
echo 'selected';?> > <?php echo $country['COUNTRY'];?></option>
<?php
}
?>
</select>
</br>
</br>
<input name="id" type="hidden" id="id" value="<?php echo $dataPacket['id']; ?>">
<input name="update" type="submit" value="update"/>
<input name="Reset" type="Reset" value="Reset"/>
<input name="Cancel" type="button" value="Cancel"/>
</div>
</div>
</center>
</form>
editProfile_action.php
<?php
include("connect.php");
session_start();
//..........................................Variable default section.........................................................
$userName=$_REQUEST['userName'];
$userfatherName =$_REQUEST['userfatherName'];
$userOccupation =$_REQUEST['userOccupation'];
$userNationality =$_REQUEST['userNationality'];
$userReligion=$_REQUEST['userReligion'];
$userAddress=$_REQUEST['userAddress'];
$userDesignation =$_REQUEST['userDesignation'];
$Country=$_REQUEST['country'];
$id=$_REQUEST['id'];
//............................................Update data........................................................................
$query=" Update create_profile set
userName='$userName',
userfatherName='$userfatherName',
userOccupation='$userOccupation',
userNationality='$userNationality',
userReligion='$userReligion',
userAddress='$userAddress',
userDesignation='$userDesignation',
country='$Country' WHERE id=".$id
;
$result=mysql_query($query);
if($result)
{
echo "Ur Profile is updated";
echo "</br>";
?>
<script language="javascript">
window.location="viewMyProfile.php?id=<?php echo $id;?>";
</script>
<?php
}
?>
0 Response to "Simple Project(part-3d)"
Post a Comment