tmyonline Posted November 17, 2007 Share Posted November 17, 2007 Hi guys: My page has two parts; part I on top is where users enter data. After they enter data and click "save", those data will be displayed in part II (in the bottom of the same page). Is there a way that I can make the input data remain on the form after users click the save/add-row/remove-row button ? This is needed in case users need to make changes to their entries; if they are all gone upon the clicking of a button, the users will have to re-type everything from scratch and they can get mad at me for this! I was trying to use session variables to store the values but I wasn't sure how to do this for input values. Here's a sample of my code: for ($j = 1; $j <= 6; $j++) { echo '<td>'; echo "<input type=\"text\" name=\"text_" . "1" . "$j\" /><br />"; echo "<input type=\"int\" name=\"image_" . "1" . "$j\" /><br />"; echo "<input type=\"int\" name=\"material_" . "1" . "$j\" /><br />"; echo '</td>'; } Any idea or alternatives ? Thanks a lot. Link to comment https://forums.phpfreaks.com/topic/77743-how-to-make-entries-remain-on-the-form-after-clicking-submit-button/ Share on other sites More sharing options...
rarebit Posted November 17, 2007 Share Posted November 17, 2007 Get the inputted data: $name = $_POST['name']; When generate form, use the inputted data: <input type='text' name='name' value='".$name."'> Link to comment https://forums.phpfreaks.com/topic/77743-how-to-make-entries-remain-on-the-form-after-clicking-submit-button/#findComment-393537 Share on other sites More sharing options...
rarebit Posted November 17, 2007 Share Posted November 17, 2007 P.S. Use code tags! (#) Link to comment https://forums.phpfreaks.com/topic/77743-how-to-make-entries-remain-on-the-form-after-clicking-submit-button/#findComment-393538 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.