Reply to Re: Get cell and textbox values from a html table when the textboxes have same names

Your name:

Reply:


Posted by GD on 04/01/07 16:18

It works great. Thanks!

GD

"Rami Elomaa" <rami.elomaa@gmail.com> wrote in message
news:eunlpr$jke$1@nyytiset.pp.htv.fi...
> GD kirjoitti:
>> 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>
>> -----------------------------------------------
>>
>
> Add [] to the field names so that php makes an array of them:
> <input type='text' name='txtTest[]'>
>
> Then you can access them thru $_POST['txtTest'][0] etc...
>
> --
> Rami.Elomaa@gmail.com
> "Olemme apinoiden planeetalla."

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация