These are my codes
1) When I want to update a person's details, I have to first choose the person.
<!doctype html>
<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js ie7 oldie" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js ie8 oldie" lang="en"> <![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js" lang="en">
<!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Community Night Cycling 2014 Singapore</title>
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1.0,user-scalable = no">
<meta name="googlebot" content="index, follow" />
<meta name="description" content="" />
<meta name="keywords" content="" />
<meta name="author" content="" />
<link rel="stylesheet" href="style/general.css" />
<link rel="stylesheet" href="style/framework.css" />
<link rel="stylesheet" href="style/site.css" />
<script src="js/modernizr-2.0.6.min.js" type="text/javascript"></script>
</head>
<body class="contact">
<header class="mast-head stack-fixed clearfix">
<!-- end .main-nav -->
</header>
<form name="input" action="insert-update.php" method="POST">
$result = mysql_query("SELECT * FROM members ", $connection);
echo 'SELECT Name <select name="name">';
while($row=mysql_fetch_array($result))
{
echo "<option value='".$row['Name']."'>".$row['Name']."</option>";
}
echo "</select>";
?>
<input type="submit" value="Submit">
</form>
<!-- end .mother -->
<script src="js/jquery.min.js" type="text/javascript"></script>
<script defer src="js/accessories-min.js" type="text/javascript"></script>
<script defer src="js/site.js" type="text/javascript"></script>
<!--[if lt IE 7 ]>
<script src="//ajax.googleapis.com/ajax/libs/chrome-frame/1.0.3/CFInstall.min.js"></script>
<script>window.attachEvent('onload',function(){CFInstall.check({mode:'overlay'})})</script>
<![endif]-->
</body>
</html>
2)After I choose the person from the dropdown list and click on Submit from thee previous page, it redirects to this page. Here I am having problem to retrieve and display the data as well as the input types to update particulars. I feel tat the problem is coming from the while loop becoz I can only see the table border displaying field and value:
<!doctype html>
<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js ie7 oldie" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js ie8 oldie" lang="en"> <![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js" lang="en">
<!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Community Night Cycling 2014 Singapore</title>
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1.0,user-scalable = no">
<meta name="googlebot" content="index, follow" />
<meta name="description" content="" />
<meta name="keywords" content="" />
<meta name="author" content="" />
<link rel="stylesheet" href="style/general.css" />
<link rel="stylesheet" href="style/framework.css" />
<link rel="stylesheet" href="style/site.css" />
<script src="js/modernizr-2.0.6.min.js" type="text/javascript"></script>
</head>
<body class="contact">
<header class="mast-head stack-fixed clearfix">
<!-- end .main-nav -->
</header>
<form name="input" action="process-update.html" method="post">
$selname=$_POST['name'];
{
$result=mysql_query("SELECT * FROM members WHERE Name = ' ".$selname." ' ", $connection);
}
echo "";
while($row = mysql_fetch_array($result))
{
echo "";
$fgender = $row['Gender'];
if ($fgender == "Male")
{
echo "";
}
else
{
echo "";
}
echo "";
echo "";
echo "";
echo "";
echo "";
}
echo "
Field | Value |
---|
Name | <input type='text' name='uName' readonly='readonly' value='".$row['Name']."'> |
Gender | Male<input type='radio' name='uGender' value='Male' checked>";
echo "Female<input type='radio' name='uGender' value='Female'> |
Gender | Male<input type='radio' name='uGender' value='Male'>";
echo "Female<input type='radio' name='uGender' value='Female' checked> |
Age | <input type='text' name='uAge' value='".$row['Age']."'> |
Email | <input type='text' name='uEmail' value='".$row['Email']."'> |
NRIC | <input type='text' name='uNRIC' value='".$row['NRIC']."'> |
Address | <textarea name='uAddress' value='".$row['Address']."'> |
ZipCode | <input type='text' name='uZipCode' value='".$row['Contact']."'> |
";
mysql_close($connection);
?>
Update<input type='radio' name='fAction' value='Update' checked>
Delete<input type='radio' name='fAction' value='Delete'>
<input type="submit" value="Submit">
</form>
<!-- end .mother -->
<script src="js/jquery.min.js" type="text/javascript"></script>
<script defer src="js/accessories-min.js" type="text/javascript"></script>
<script defer src="js/site.js" type="text/javascript"></script>
<!--[if lt IE 7 ]>
<script src="//ajax.googleapis.com/ajax/libs/chrome-frame/1.0.3/CFInstall.min.js"></script>
<script>window.attachEvent('onload',function(){CFInstall.check({mode:'overlay'})})</script>
<![endif]-->
</body>
</html>