bodyland Posted January 25, 2007 Share Posted January 25, 2007 Hi: I have a code here that's supposed to be designed to be able to update a MySql table. Another part of htis page works to add new entries, and it works fine, but I can't edit material that's already there. This is the part of the page I think that deals with editing info. I don't know what's wrong with it.[code]function ShowEditRecord() { include('variables.php'); $edit_str = CookieSupport();// $edit_str.= "<br><br>"; $edit_str.= "<form method=\"POST\" action=\"data.php?pg=".$_COOKIE['pg']."\" name=\"editform\">"; $edit_str.= "<table width=\"500\" cellspacing=\"1\" cellpadding=\"0\" align=\"center\" border=\"0\">"; for ($i=0;$i<=20;$i++) { $edit_str.= "<input type=\"text\" name=\"".$dbcol_name[$i]."\" class=\"hiddenbtn\">"; $edit_str.= "<script> window.editform.".$dbcol_name[$i].".value= '".$GLOBALS[$dbcol_name[$i]]."';</script>"; } for ($i=1;$i<=20;$i++) { $edit_str.= " <tr>"; $edit_str.= " <td class=\"link\" width=\"150\">".$col_name[$i]."</td>"; $edit_str.= " <td><input type=\"text\" name=\"new".$dbcol_name[$i]."\" class=\"fields\"></td>"; $edit_str.= " <td><input type=\"text\" name=\"old".$dbcol_name[$i]."\" class=\"hiddenbtn\"></td>"; $edit_str.= " </tr>"; $edit_str.= "<script>"; $edit_str.= " window.editform.new".$dbcol_name[$i].".value= Get_Cookie('old".$dbcol_name[$i]."');"; $edit_str.= " window.editform.old".$dbcol_name[$i].".value= Get_Cookie('old".$dbcol_name[$i]."');"; $edit_str.= "</script>"; } $edit_str.= " <tr>"; $edit_str.= " <td height=\"50\" align=\"center\" colspan=\"3\">"; $edit_str.= " <input class=\"buttons\" type=\"submit\" name=\"EditOK\" value=\" OK \">"; $edit_str.= " <input class=\"buttons\" type=\"button\" name=\"cancel\" value=\"Cancel\" onclick=\"history.back()\">"; $edit_str.= " </td>"; $edit_str.= " </tr>"; $edit_str.= "</table>"; $edit_str.= "</form>"; $edit_str.= ""; return $edit_str;}[/code] Link to comment https://forums.phpfreaks.com/topic/35719-mysql-form/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.