newtoall Posted May 21, 2007 Share Posted May 21, 2007 Please help................. Hopefully this is somthing really obvious that I can't see. Below is a form that shows multiple rows depending on the number or records being returned from a database query. This worked fine however I have tried to slot a select item into this dynamic form and now only one row is show on the webpage where there should be 6. Is it possible to slot a select item into a form? if so what am I doing wrong? Any help would be great I am still new to PHP and learning as I go! <form name='timesheetForm' method='post' action=''> <table bgcolor='#CCD6E4'> <tr> <tr> <td><font size="2" face="Arial, Helvetica, sans-serif"> Project code</td> <td><font size="2" face="Arial, Helvetica, sans-serif">Monday</td> <td><font size="2" face="Arial, Helvetica, sans-serif">Tuesday</td> <td><font size="2" face="Arial, Helvetica, sans-serif">Wednesday</td> <td><font size="2" face="Arial, Helvetica, sans-serif">Thursday</td> <td><font size="2" face="Arial, Helvetica, sans-serif">Friday</td> <td><font size="2" face="Arial, Helvetica, sans-serif">Saturday</td> <td><font size="2" face="Arial, Helvetica, sans-serif">Sunday</td> <td><font size="2" face="Arial, Helvetica, sans-serif">Totals</td> </tr> <?php for($i = 0; $i<$TimesheetPs; $i++) { ?> <tr> <td><select name = "PCode[]"> <?php for($i = 0; $i<$project_lists; $i++) { echo '<option value = '.$project_list[$i][0]; if ($TimesheetP[$i][0] == $project_list[$i][0]) echo ' selected'; echo '>'.$project_list[$i][1]."</option>\n"; } ?></select></td> <td><input type='text' name='MonTime[]' value="<?php echo $TimesheetP[$i][5];?>" size=10 maxlength=10></td> <td><input type='text' name='TueTime[]' value="<?php echo $TimesheetP[$i][6];?>" size=10 maxlength=10></td> <td><input type='text' name='WedTime[]' value="<?php echo $TimesheetP[$i][7];?>" size=10 maxlength=10></td> <td><input type='text' name='ThuTime[]' value="<?php echo $TimesheetP[$i][8];?>" size=10 maxlength=10></td> <td><input type='text' name='FriTime[]' value="<?php echo $TimesheetP[$i][9];?>" size=10 maxlength=10></td> <td><input type='text' name='SatTime[]' value="<?php echo $TimesheetP[$i][10];?>" size=10 maxlength=10></td> <td><input type='text' name='SunTime[]' value="<?php echo $TimesheetP[$i][11];?>" size=10 maxlength=10></td> <td><input type='text' name='TotalTime[]' value="<?php echo $TimesheetP[$i][12];?>" size=10 maxlength=10></td> <td><input type='hidden' name='WeekID[]' value="<?php echo $TimesheetP[$i][4];?>" size=10 maxlength=10></td> <td><input type='hidden' name='ProjectD[]' value="<?php echo $TimesheetP[$i][3];?>" size=10 maxlength=10></td> <td><input type='hidden' name='ProjectID[]' value="<?php echo $TimesheetP[$i][0];?>" size=10 maxlength=10></td> <td><input type='hidden' name='WeekID[]' value="<?php echo $TimesheetP[$i][12];?>" size=10 maxlength=10></td> <td><input type='hidden' name='StatusCode[]' value="<?php echo $TimesheetP[$i][11];?>" size=10 maxlength=10></td> </tr> <?php } ?> <tr> <td colspan=9 align='right'> <input type='submit' value='Submit Timesheet'></td></tr> </table></form> Link to comment https://forums.phpfreaks.com/topic/52388-a-form-to-show-multiple-rows-at-once/ Share on other sites More sharing options...
chigley Posted May 21, 2007 Share Posted May 21, 2007 <?php for($i = 0; $i<$project_lists; $i++) { echo '<option value = '.$project_list[$i][0]; if ($TimesheetP[$i][0] == $project_list[$i][0]) echo ' selected'; echo '>'.$project_list[$i][1].'</option>\n'; } ?> Not 100% if that's the problem, but try that Link to comment https://forums.phpfreaks.com/topic/52388-a-form-to-show-multiple-rows-at-once/#findComment-258527 Share on other sites More sharing options...
newtoall Posted May 21, 2007 Author Share Posted May 21, 2007 Cheers, slotted this in but the form is still only one row is returned. I have been looking a bit further and it looks like the inner select code causes the outer loop to stop but I don't know why?? Link to comment https://forums.phpfreaks.com/topic/52388-a-form-to-show-multiple-rows-at-once/#findComment-258530 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.