Display old and new values in form

hi all

In “change address details” form i m displaying all fields values as


<input type="text" name="user_city" value="<? echo row['user_city']) ?>" />
<input type="text" name="user_country" value="<? echo row['user_country']) ?>" />

I m validating the form with php and showing errors through php

so after click of submit button i want to retain form values and display

  1. new data values entered in input fields (in which user made changes)

  2. old data values from database in which user didnt made any changes

vineet

So what you are saying is you want to display what is currently in the database?

If so, the code should read roughly:

do update of new values into db
select the new row again
display the new row’s values into the form

If this is not what you mean, then explain further.

I think you may be referring to if something fails (such as missing a required field), you do not want the user to lose what they have already entered, even if those changes my not yet be stored in the table.

Depending on how your set up, you may need to set the array of their updates to a session so that it can survive multiple HTTP requests, and then be called later to populate the form again.