plz help me with multiple textboxes in php - Printable Version +- Support Forums (https://www.supportforums.net) +-- Forum: Categories (https://www.supportforums.net/forumdisplay.php?fid=87) +--- Forum: Coding Support Forums (https://www.supportforums.net/forumdisplay.php?fid=18) +---- Forum: PHP The Hypertext Preprocessor (https://www.supportforums.net/forumdisplay.php?fid=21) +---- Thread: plz help me with multiple textboxes in php (/showthread.php?tid=3469) |
plz help me with multiple textboxes in php - niro_fernando - 12-10-2009 i m new to php , i want to know how get data from multiple textboxes can i name text boxes as like a arry, is it correct ,and how to display them i return them like this echo $_POST[txtName[0]] but it is not working , plz help me this is the code <html> <head><title>Student Marks Calculator </title></head> <body> <form name ="My Data" method ="POST"> <table> <tr> <td>Name</td><td>Maths</td><td>Science</td><td>English</td> </tr> <tr <td><input type="text" name=txtName[0]/></td> <td><input type="text" name=txtMaths[0] /></td> <td><input type="text" name=txtScience[0] /></td> <td><input type="text" name=txtEnglish[0] /></td> </tr> <tr> <td><input type="text" name=txtName[1]" /></td> <td><input type="text" name=txtMaths[1]" /></td> <td><input type="text" name=txtScience[1]" /></td> <td><input type="text" name=txtEnglish[1]" /></td> </tr> <tr> <td><input type="text" name=txtName[2] /></td> <td><input type="text" name=txtMaths[2] /></td> <td><input type="text" name=txtScience[2] /></td> <td><input type="text" name=txtEnglish[2] /></td> </tr> <tr> <td><input type="text" name=txtName[3] /></td> <td><input type="text" name=txtMaths[3] /></td> <td><input type="text" name=txtScience[3] /></td> <td><input type="text" name=txtEnglish[3] /></td> </tr> <tr> <td><input type="Submit" name="Report" value="Gen Report" /></td> <td><input type="Submit" name="Reset" value="Reset" /></td> </tr> <?php ?> </body> </html> RE: plz help me with multiple textboxes in php - MattR - 12-10-2009 Remove the numbers from the arrays (I don't know if that would stop it working but I personally don't put it in. Then you'd do this: PHP Code: foreach($_POST['txtName'] as $key => $val) See how that works. RE: plz help me with multiple textboxes in php - niro_fernando - 12-11-2009 thanks MattR , |