PHP_Idiot Posted April 7, 2009 Share Posted April 7, 2009 I have a table that generates rows based on user input and it displays the number of players, and the points earned for each position. then is a text field for membership numbers. Following that I want to look up FirstName & LastName as a sanity check. Before I do that I understand that I need to uniquely name each row under First & Last Name, probably based on the $counter value. Here is my tables current code for ( $counter = 1; $counter <= $PlayerNo; $counter += 1) { echo "<tr><td align='center' valign='center'>"; echo $counter; echo "</td><td align='center' valign='center'>"; echo $points = isset($pointsArray[$counter]) ? $pointsArray[$counter] : 25; ; echo "</td><td align='center' valign='center'>"; echo '<input name="MembershipNo" type="text" size="7" maxlength="7">'; echo "</td><td align='center' valign='center'>"; echo '<input name="FirstName $counter" type="text" size="15" maxlength="7">'; echo "</td><td align='center' valign='center'>"; echo '<input name="LastName[$counter]" type="text" size="15" maxlength="7">'; echo "</td></tr>"; I have tried both of the following but without success: echo "</td><td align='center' valign='center'>"; echo '<input name="FirstName $counter" type="text" size="15" maxlength="7">'; echo "</td><td align='center' valign='center'>"; echo '<input name="LastName[$counter]" type="text" size="15" maxlength="7">'; echo "</td></tr>"; Just to be clear I don't want to change the display at this moment in time, just change the name as viewed in 'view source' eg name="FirstName" (and LastName) changed to name="FirstName1", name="FirstName2" etc for the full value of the $counter. Many Thanks Link to comment https://forums.phpfreaks.com/topic/153001-solved-uniquely-naming-table-cells-based-on-counter-value/ Share on other sites More sharing options...
phil88 Posted April 7, 2009 Share Posted April 7, 2009 echo "</td><td align='center' valign='center'>"; echo "<input name='FirstName".$counter."' type='text' size='15' maxlength='7'>"; echo "</td><td align='center' valign='center'>"; echo "<input name='LastName".$counter."' type='text' size='15' maxlength='7'>"; echo "</td></tr>"; Should do it. Link to comment https://forums.phpfreaks.com/topic/153001-solved-uniquely-naming-table-cells-based-on-counter-value/#findComment-803577 Share on other sites More sharing options...
PHP_Idiot Posted April 7, 2009 Author Share Posted April 7, 2009 Thats perfect thanks a lot I Don't suppose you can help with the next step can you? I need to get the FirstName and LastName cells to up date with the names that correspond to the membership number typed on the same row, Ideally I want this update to occur as soon as the membership number is typed in rather than having to fill them all and click a button to perform the query. The test form can be seen at www.gbpokerclub.co.uk/testform.php, fill this in and hit the create form button and you will see the table I'm talking about. Many Thanks Link to comment https://forums.phpfreaks.com/topic/153001-solved-uniquely-naming-table-cells-based-on-counter-value/#findComment-803607 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.