hey,
thanks for getting back.
I have a 2 steps problem...
I have to finish an insert form and an update one.
let's talk about the insert.
my problem is I can't manage to make it work:
I have one function which draws the form as soon as the page loads:
function insert_row($table,$data){
$query = "DESCRIBE $table";
$result = mysql_query($query);
print "<DIV ALIGN=\"CENTER\">";
print "<table border=1>\n";
print "<FORM METHOD='POST' ACTION='$PHP_SELF'>";
$counter = 0;
while ($row = mysql_fetch_array($result,MYSQL_NUM)) {
$counter++;
print "\t<tr>\n";
print "<td><b>$row[0]</b></td>";
if ($counter == 1 || $counter ==2) {
print "<td>auto</td>";
} else {
print "<td><INPUT TYPE='text' NAME='data' VALUE='' SIZE=13 style=\"border-style: solid\"></td>";
}
print "\t</tr>\n";
}
print "</table>\n";
print "<br>";
print "<INPUT TYPE='submit' name='submit2' value='Insert a new Row' style=\"border-style:
solid\">";
print "</FORM>";
print "</DIV>";
}
then I have another which should insert the record(not working):
function insertnew_row($table,$data){
$query = "DESCRIBE $table";
$result = mysql_query($query);
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
print "<td><b>$row[0]</b></td>\n";
}
print $query;
$result=MYSQL_QUERY("INSERT INTO $table(value) VALUES('".$_POST["data"]."')");
print $result;
#print "record added";
#echo $query; // to show what sent
}
then I call the latter from a main page:
if($submit2){
insertnew_row($table,$data);
}
thanks for your help..
sub