473,783 Members | 2,287 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Retain Form Values after EDIT

114 New Member
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 3147
nathj
938 Recognized Expert Contributor
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 New Member
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 Recognized Expert Contributor
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
5502
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 enters disappears everytime the form is refreshed when posting it to itself. Is there anyway I can retain the values that were entered on the form?
2
3126
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 created.(all values are set to zero) What i need to do is retain the value of a textbox(a total)on the clear input form(total from previous day)
25
4073
by: Neo Geshel | last post by:
This works: <form> <asp:TextBox id="name" /> <%= name.ClientID %> </form> But this DOES NOT work: <form>
6
4647
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 does so far and is failing to do ******************************* <?php session_start(); header("Cache-control: private"); //IE 6 Fix include("myconn.php");
3
1676
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 parent form is getting refeshed but the values are not retained..could some one tell me how to retain the values... thanks
12
6954
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 death and cant find the answer (only hints), except on the 'Experts Exhange' page and you have to pay to get the answer :-( Why is this such a secret in the open source world we live in? Daniel Klein
5
10320
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 submit the form. NOW I WANT SOME JAVASCRIPT / PHP FUNCTIONALITY WHICH WILL GIVE ME THE types & values OF ALL ELEMENTS ON FORM WHICH SHOULD BE before
4
8564
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 when it displays it shows values from the database and i have a link button edit on the ItemTemplate that changes the mode to edit mode and allows to edit the values which can be edited...
9
5751
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 displayed to intimate the user like ' u wrongly enter the value'.. in button click all the textbox values are erased. so can anybody tell me how to retain the value of textbox(without GET method because it is an unsecured one.. since all the values...
0
9643
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10081
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9946
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8968
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7494
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5378
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4044
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3643
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.