Posted by GD on 04/01/07 06:39
Hi,
I am trying to get values from table cells and textboxes that have same
component names in a table after posting to the same page. Javascript is
able to get the component values while the components have same names. For
example:
for (var i=0; i < document.FormTest.txtTest.length; i++)
{
alert(document.FormTest.txtTest[i].value);
}
How to do it using PHP? The following is the test code:
-------------------------------------------------------
<html>
<head> <title>Test</title></head>
//try to get values after posting
<?php
$textboxValue = $_POST['txtTest'];
echo $textboxValue;
?>
<body bgcolor="#ebeaff" >
<form name="FormTest" id="FormTest" action="test.php" method="post" >
<?php
echo "<table>";
for ($counter = 0; $counter <= 3; $counter++)
{
echo "<tr><td><input type='text' name='txtTest'></td><td>cell
value</td></tr>";
}
echo "</table>";
?>
</form>
</html>
-----------------------------------------------
Thanks.
GD
Navigation:
[Reply to this message]
|