I just need a help in the following case:-
//tables
my Audio table fields are id,name,author,catid.
(1,John,netmastan,2)
here 2 refers to Category 2 which is a Video.
cat table fields are catid,cat. (1,Audio;2.Video)
//Adding form
Name :
Author :
Cat: here shows drop downlist of category
$result3=mysql_query("select catid, cat from cat order by cat", $dbi);
echo "Category: <select name=\"catx\">";
while(list($shkid, $title) = mysql_fetch_row($result3, $dbi)) {
echo "<option value=\"$catid\">$cat</option>";
}
echo "</select><br>";
I used hidden attribute to call add function.
//adding funciton
function add($name,$author,$catx)
inserting to name=$name,author=author,catid=$catx
Everything works fine. But the problem in updating form
//updating form
name,value $name
author value $author
Category <<< As i know only catid..I need to use sql query to find category name accroding to catid.
so I use
$result3=mysql_query("select catid, cat from cat order by cat", $dbi);
echo "Category: <select name=\"catx\">";
while(list($shkid, $title) = mysql_fetch_row($result3, $dbi)) {
echo "<option value=\"$catid\">$cat</option>";
}
echo "</select><br>";
//here is use input hidden code to call modify function
//modifying function
function modify($name,$author,$catx)
update audio set ..name=$name,author=$author,catid=$catx
Let say orginal category was 2. And i want to show 2 as selected in the drop downlist when i come to the modification form. But it's not doing such things.It just shows list of category . And if i update the audio withought changing the category ..it update all fields correctly except the category. It always select different category then it's original.
May be sometimes..I just want to change name..it will update name as well as category .I do not want to update the category unless i select different category from the list.