How to get table values into textbox
Posted: Wed Jan 25, 2012 11:36 pm
Please help me on this.
I have a file called 'category.php' which display some of the categories from my database. Also have 'edit' button for each categories displaying.
On clicking the edit button, 'edit category.php' will be diplayed. The thing i need is, I want to bring the category names into the 'edit category.php' pages. so that i can edit and update the categories in to my database using these pages.
The coding for both these files are displayed here.
Here is category.php
And here is edit category.php
I have a file called 'category.php' which display some of the categories from my database. Also have 'edit' button for each categories displaying.
On clicking the edit button, 'edit category.php' will be diplayed. The thing i need is, I want to bring the category names into the 'edit category.php' pages. so that i can edit and update the categories in to my database using these pages.
The coding for both these files are displayed here.
Here is category.php
Code: Select all
<?php
$con = mysql_connect("localhost", "root", "");
$db = mysql_select_db("ooi_admin", $con);
$query = "SELECT * FROM `specialization`";
$result=mysql_query($query, $con);
?>
<html>
<head>
<title>Untitled Document</title>
</head>
<body>
<div align="center">
<table width="300" border="1" cellspacing="0" cellpadding="0">
<tr>
<td colspan="2"><div align="right">Add Category</div></td>
</tr>
<tr>
<td><div align="center">Category Name</div></td>
<td><div align="center">Manage</div></td>
</tr>
<?php
while($row=mysql_fetch_array($result))
{
echo "<tr>";
$category=$row['s_name'];
echo "<td>";
echo "$category";
echo "<td>";
echo "<a href='edit category.php'><img src='images/edit.gif'/></a>";
echo "</td>";
echo "</tr>";
}
?>
</table>
</div>
</body>
</html>
Code: Select all
<?php
$con = mysql_connect("localhost", "root", "");
$db = mysql_select_db("ooi_admin", $con);
$query = "SELECT * FROM `specialization`";
$result=mysql_query($query, $con);
?>
<html>
<head>
<title>Untitled Document</title>
</head>
<body>
<div align="center">
<table width="300" border="1" cellspacing="0" cellpadding="0">
<tr>
<td colspan="2">Edit Category</td>
</tr>
<tr>
<td height="39"><div align="center">Category Name</div></td>
<td><div align="center"><input type="text" name="category name"></div></td>
</tr>
</table>
</div>
</body>
</html>