Jump to content

form fields not retaining data on post


Recommended Posts

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="">
 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.



Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.