Jump to content

Form Submition in table rows


menwn

Recommended Posts

Hello everyone,

 

I have a form containing a table and I can add table rows in the table using javascript. Each row has a textbox at the beginning that is has as value the number of the row.

 

When I press submit I use post to send the data to a php script. The script has some code like

$i=1;
while($_POST['SpecificFieldrow'.$i]!="")
{
switch ($_POST['SpecificFieldrow'.$i])
		{
                           case "email": 
                            {                              
                             //do stuff like
                              if(isset($_POST['genericnull'.$i]))
						{
							$myform->rulesValid('email');
						}
						break;
				}
                             //more cases
//etc
$i++;
}

 

The obvious problem with the above code is that if I would like to change the order with which the fields of the rows of the table will be handled by the script I would have to change the numbers in the textbox and have some javascript to change the name in the "SpecificFieldrow".$i (where $i now would be the new number provided by the use) when the number textbox is changed.

 

I would like to avoid this. Is it possible?  How can I send the table row by row so as to have code sorting the requests by the numbering fields and enabling the user to choose the order by which the fields will be proccessed?

 

Thank you in advance for any help

menwn

 

Link to comment
https://forums.phpfreaks.com/topic/151547-form-submition-in-table-rows/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.