<div style="font-family:tahoma; color:#F00; ">
<?php
session_start();
if (isset($_SESSION['user']))
echo "You are logged in as ".$_SESSION['user'], " to log out click <a href =logout.php>here</a>";
else
die ("Please Register <a href =register.php>here</a>");?>
</div>
<?php
$username = $_SESSION['user'];
if(!isset($_SESSION['user']))
{
header("location: login.php");
}
else
{
$query=" SELECT * FROM users WHERE user='$username'";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
$i=0;
while ($i < $num) {
$fn=mysql_result($result,$i,"FirstName");
$sn=mysql_result($result,$i,"SecondName");
$gen=mysql_result($result,$i,"Gender");
$email=mysql_result($result,$i,"Email");
$location=mysql_result($result,$i,"Location");
$username=mysql_result($result,$i,"user");
$password=mysql_result($result,$i,"password");
++$i;
}
$u_fn=$_POST['FirstName'];
$u_sn=$_POST['SecondName'];
$u_gen=$_POST['Gender'];
$u_email=$_POST['Email'];
$u_location=$_POST['Location'];
$u_username=$_POST['user'];
$u_password=$_POST['password'];
$query1="UPDATE users SET FirstName = '$u_fn', SecondName='$u_sn', Gender='$u_gen', Email='$u_email', Location=$u_location, user= $u_username, password='$u_password',";
mysql_query($query1);
echo "Record Updated";
mysql_close();
}
?>
<div id = "registercontent">
<h1> Edit your profile information here!</h1><br />
<form id='profile' style="text-align:left;" action='<?php echo $_SERVER['PHP_SELF']; ?>' method='post'
accept-charset='UTF-8'>
<fieldset >
<legend><b>Enter details to create an account</b></legend>
<input type='hidden' name='submitted' id='submitted' value='1'/><br />
<label for='FirstName' >First Name: </label>
<input type='text' name='FirstName' id='FirstName' "maxlength="50" value = '<?php echo $fn ?>' /><br /><br />
<label for='SecondName' >Second Name:</label>
<input type='text' name='SecondName' id='SecondName' maxlength="50" value = '<?php echo $sn ?>'/><br /><br />
<label for='gender' >Gender :</label>
<input type="radio" name="gender1" <option value='<?php echo $gen ?>'>Male</option>
<input type="radio"
name="gender2" value="female">Female<br><br />
<label for='Email' >Email Address:</label>
<input type='text' name='Email' id='Email' maxlength="50" value = '<?php echo $email ?>'/><br /><br />
<label for='Location' >Location :</label>
<input type='text' name='Location' id='Location' maxlength="50"value = '<?php echo $location ?>' /><br /><br />
Please select your sports of interest from the list :<br /><br />
<select size="5" name="sport" multiple >
<option selected>
<option>Athletics
<option>Badminton
<option>Basketball
<option>Beach Volleyball
<option>Boxing
<option>Canoe Slalom
<option>Canoe Sprint
<option>Cycling - BMX
<option>Cycling - Mountain Bike
<option>Cycling - Road
<option>Cycling - Track
<option>Diving
<option>Equestrian
<option>Fencing
<option>Football
<option>Gymnastics - Artistic
<option>Gymnastics - Rhythmic
<option>Handball
<option>Hockey
<option>Judo
<option>Modern Pentathlon
<option>Rowing
<option>Sailing
<option>Shooting
<option>Swimming
<option>Synchronised Swimming
<option>Table Tennis
<option>Taekwondo
<option>Tennis
<option>Trampoline
<option>Triathlon
<option>VolleyballWater Polo
<option>Weightlifting
<option>Wrestling
</select>
<i>(Hold CTRL while selecting sports)</i>
<br /><br />
Please create a username and password you will use to sign in :<br /><br />
<label for='username' >Username: </label>
<input type='text' name='username' id='username' maxlength="50"value = '<?php echo $username ?>' /><br /><br />
<label for='password' >Password: </label>
<input type='password' name='password' id='password' maxlength="50"value = '<?php echo $password ?>' /><br /><br />
<label for='repeatpass' >Repeat Password: </label>
<input type='password' name='repeatpass' id='repeatpass' maxlength="50" value = '<?php echo $password ?>'/><br /><br />
<input type="Submit" value="Update">
<input type="Submit" value="Cancel">
</fieldset>
</form>
</div>
<div style="font-family:tahoma; color:#F00; ">
i am having problems with my updating to the database, the information is shown in the form but when i click update it is not updating to the database, but is just refreshing the page... any help?