473,320 Members | 2,006 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Retain Form Values after EDIT

114 100+
Hi Fellas, i need to understand how to retain the submtted form values during an Edit/Update operation.

When i add the information from a form, i retain the form values in the following way incase there is something missing or the values are incorrect.

[PHP]<input type="text" name="camount" tabindex="4" value="<?php echo $form->value("camount"); ?>" >[/PHP]

When i edit this information i retrieve the value in the following manner

[PHP]<input type="text" name="camount" tabindex="4" value="<?php echo $camount; ?>" [/PHP]

Now when i submit this edit information, how should i retain those submmitted values if incase there is an error/mistake again because i have no where i can put something like [PHP]<?php echo $form->value("camount"); ?> [/PHP] again. Which means in an edit operation the value property of a input box is already occupied by the value from the database and as a result i dont have the place where i can retain the value submitted incase if i have to return back to the same page if there is an error or mistake in the submission. The same is for the <textarea> tag cause it doesnt have even the value property.

So please tell me what is the actual funda?
Sep 1 '08 #1
3 3119
nathj
938 Expert 512MB
Hi,

If I understand correctly (a big if I admit) then you have an input box, say a text box for example, and this contains a value stored in a database.

A user comes along and loads the page with the form and the text box and decides to edit the data and save it back to the database.

In this case you have the data they wish to save and all is well. If you wish to retain the original data as well as the new data then I suggest one of the following options.

1. Load each control on the form twice - one that the users sees and edits and one that is hidden. This would give you all the data you need.

2. When the form is submitted get the original data from the DB again to check the new data against. This would enable you to build up an update statement for only the fields that need to be updated

3. Load the form initially as read only. When the user clicks 'edit' simply take all the current vales and load them into the $_SESSION so that you have access to them when the form is submitted.

Those are my ideas for the solution. If I have missed the mark completely let me know and I'll try again.

Cheers
nathj
Sep 1 '08 #2
raaman rai
114 100+
Yea Nathj, you are 100% rite understanding my question. And i also acknowledge you for your idea which never came to my mind before. I am sure your idea will work and i am gonna try it now only. Wish me goodluck and thankyou so much.
Sep 1 '08 #3
nathj
938 Expert 512MB
Yea Nathj, you are 100% rite understanding my question. And i also acknowledge you for your idea which never came to my mind before. I am sure your idea will work and i am gonna try it now only. Wish me goodluck and thankyou so much.
Hi,

I'm glad to have been of help. I'll keep an eye on this thread so if you get stuck post back with the details and the code snippet and I'll try to help more.

Cheers
nathj
Sep 1 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: J P Singh | last post by:
I have simple form where user enter the search criteria and the form is posted back to itself and runs a query based on the values that are entered. Everything is expect the values that the user...
2
by: kevin carter | last post by:
Hi we have a form that accepts inputs from the user at the end of the day the data that has been input is stored on a table,(all textboxes are bound to the table) THe next day a clear form is...
25
by: Neo Geshel | last post by:
This works: <form> <asp:TextBox id="name" /> <%= name.ClientID %> </form> But this DOES NOT work: <form>
6
by: Ian Davies | last post by:
Hi me again, sorry to be a pain. Ive been struggling with this one all day. Hope you can understand whats happening. First my script is below. Have a look and I'll explain at the bottom what it...
3
by: arunvasuki | last post by:
Hi, I have a form with a few edit boxes. In the form i also have a search button which takes me to a small pop up window. After searching i am getting back the values in to the parent form..also the...
12
by: Daniel Klein | last post by:
I'm pretty new at php and web stuff so please be gentle with me. I'm trying to get a form to submit when the user presses the Enter key. I do not want to use javascript. I've googled this to...
5
by: Rider | last post by:
Hi All, Here is the reason why i ak asking for ur help. I have a edit form in which the values already stored in DB are populated. User can edit some or all the values in the form. then he...
4
by: pankajsingh5k | last post by:
Hi guys, These question is for all the experts... Please help me before my brain explodes The problem is again with the formview control.. I have a formview and i have to use it that...
9
by: sweetline priya | last post by:
hi friends.. in my page the form contains 10 textboxes. the user has to fill these textfields. if the user made any mistake in entering value in any textbox, in the button click, a message is...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.