I have created a table that allows the user to edit specific cells by clicking on them. Their new entered values set the value on the table. They then should be able to submit a form which sets several hidden inputs equal to the values in the table then passing the information to a php page to process. However, the php page doesn't output anything when it is submitted.
This is the form layout.
When the user enters all the data into the table they click on a submit button which calls a script like this...HTML Code:<form method="post" action="mypage.php" id="complex" name="complex"> <input type="hidden" id="1x1" value=""> ...etc.
NOTE: although I have the id of the cell as "1x1" it is actually the 4th row and 2nd cell of the table.Code:function getValues() { document.getElementById("1x1").value = document.getElementById('table').rows[3].cells[1]; ... document.getElementById("complex").submit();
The form is then submitted to a PHP page like such:
PHP Code:<?php
$con = mysql_connect("localhost","user","pass");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("b6_6229906_main", $con);
$1x1 = $_POST['1x1'];
$sql="INSERT INTO 'table' VALUES ('$1x1')";
if(mysql_query($sql) === FALSE ) {
die('Error: ' . mysql_error());
}
echo "1 record added";
mysql_close($con);
?>
I know this is a javascript thread but I really don't know if the error is in the javascript or php, but no PHP error is displayed. Also, there are about 75 entries being processed not just the "1x1", I just simplified it for readability.


Reply With Quote

Bookmarks