mina.azarm
یک شنبه 12 مهر 1388, 09:48 صبح
سلام دوستان
یک سوال داشتم که می خواستم ایراد من را بگیرید.
به این کد من توجه کنید:
<html>
<head>
</head>
<body>
<table border="1">
<tr><th>Name</th><th>Age</th></tr>
<?php
$host="localhost";
$user="root";
$password="";
# Connect to MySQL server
$conn = mysql_connect($host,$user,$password)
or die(mysql_error());
# Select the database
mysql_select_db("test", $conn)
or die(mysql_error());
# Send SQL query
$sql = "SELECT * FROM tablename WHERE age > 0 ORDER BY age";
$result = mysql_query($sql)
or die(mysql_error());
# Fetch table rows, one by one, and display as HTML table rows
while ($row = mysql_fetch_assoc($result)) {
echo "
<form method=\"post\" action=\"db.php\">
<tr><td>", $row['name'], "</td><td>", "<input name=\"age\" style=\"width: 49px\" type=\"text\" value=".$row['age']." />",
"</td></tr>
<input name=\"Submit1\" type=\"submit\" value=\"change\" />
</form>
\n";
}
?>
</table>
</body>
</html>
حالا می خواستم وقتی کلید change را کلیک می کنم اطلاعات تغییر یافته مربوط به سن تغییر کند.
ممنونم
یک سوال داشتم که می خواستم ایراد من را بگیرید.
به این کد من توجه کنید:
<html>
<head>
</head>
<body>
<table border="1">
<tr><th>Name</th><th>Age</th></tr>
<?php
$host="localhost";
$user="root";
$password="";
# Connect to MySQL server
$conn = mysql_connect($host,$user,$password)
or die(mysql_error());
# Select the database
mysql_select_db("test", $conn)
or die(mysql_error());
# Send SQL query
$sql = "SELECT * FROM tablename WHERE age > 0 ORDER BY age";
$result = mysql_query($sql)
or die(mysql_error());
# Fetch table rows, one by one, and display as HTML table rows
while ($row = mysql_fetch_assoc($result)) {
echo "
<form method=\"post\" action=\"db.php\">
<tr><td>", $row['name'], "</td><td>", "<input name=\"age\" style=\"width: 49px\" type=\"text\" value=".$row['age']." />",
"</td></tr>
<input name=\"Submit1\" type=\"submit\" value=\"change\" />
</form>
\n";
}
?>
</table>
</body>
</html>
حالا می خواستم وقتی کلید change را کلیک می کنم اطلاعات تغییر یافته مربوط به سن تغییر کند.
ممنونم