fife Posted March 21, 2012 Share Posted March 21, 2012 Ok from one brick wall to the next. After lots of help with my last query I moved onto the next task an I'm completely stuck again. I have a form thats created with a loop. Here is that form <form action="" method="post" id=""> <?php for ($i = 1; $i <= $totalRows_rs_cacheNum; $i++) { echo "<label>Cache ".$i."</label> <span id='sprytextfield".$i."'> <input name='cache[$i]' type='text' value='".$_POST['cache[$i]']."'/> <span class='textfieldRequiredMsg'>Required!</span></span> <div class='clear'></div>"; } ?> <input name="nextbtn" type="submit" value="Next" /> When a user enters data in all the fields, If one piece of information is incorrect an error pops up saying one of the fields you entered does not match the fields in the database. At the same time however i wish to keep the data they have entered in each of the fields. Normally you'd just write value="<?php echo $_POST['fieldName'];?>" but for some reason in this case it does not work. can someone point me in the right direction. I've tried Google many different terms but I can not find the correct term to find my answer. Hence me asking you guys again. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/259427-form-fields-not-retaining-data-on-post/ Share on other sites More sharing options...
PFMaBiSmAd Posted March 21, 2012 Share Posted March 21, 2012 The actual syntax would be - $_POST['cache'][$i] Quote Link to comment https://forums.phpfreaks.com/topic/259427-form-fields-not-retaining-data-on-post/#findComment-1329876 Share on other sites More sharing options...
fife Posted March 21, 2012 Author Share Posted March 21, 2012 thanks again PFMaBiSmAd Quote Link to comment https://forums.phpfreaks.com/topic/259427-form-fields-not-retaining-data-on-post/#findComment-1329882 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.