mrherman Posted April 18, 2010 Share Posted April 18, 2010 I have an html table that contains 1 row and 3 cells. Each of the 3 cells contains a submit button. Below the submit button in each cell are instructions for when to use the submit button. Is it possible to change the instructional text within the cell after a user clicks on a submit buttons? If so, how would I do that? (Looking for php/html/css only, since I don't know javascript.) Thanks! Link to comment https://forums.phpfreaks.com/topic/198958-change-text-within-a-html-table-cell-if-submit-button-is-clicked/ Share on other sites More sharing options...
Sergey Popov Posted April 19, 2010 Share Posted April 19, 2010 If you want to change text on button click dynamically (without reloading page) you'll have to use Javascript. Otherwise, if you wish to implement this with PHP, here is how: <html> <body> <form method="post"> <table> <tr> <?php for($i=1;$i<=3;$i++){ echo '<td>'; echo '<input type="submit" name="button'.$i.'" value="Submit '.$i.'">'; echo $_POST["button".$i]?('Text here, button '.$i.' pressed')'Default text - button not pressed'); echo '</td>'; } ?> </tr> </table> </form> </body> </html> Link to comment https://forums.phpfreaks.com/topic/198958-change-text-within-a-html-table-cell-if-submit-button-is-clicked/#findComment-1044427 Share on other sites More sharing options...
mrherman Posted April 19, 2010 Author Share Posted April 19, 2010 Thank you, Sergey. I will use this! Link to comment https://forums.phpfreaks.com/topic/198958-change-text-within-a-html-table-cell-if-submit-button-is-clicked/#findComment-1044481 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.