473,386 Members | 1,606 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,386 software developers and data experts.

How to keep entered value until user click confirm button

250 100+
I have a web page which is used to enter user data. In there I have 4 buttons named as "Submit, Confirm,Edit,Cancel". User should enter data and click "Submit " button. Then I want to display all information he entered and when user click confirm button only it should submit to the DB. Could you please tell me what is the best way? Do I need to use java script? How can I keep the form data after user click on submit button?
Expand|Select|Wrap|Line Numbers
  1. <form name="Adduser.php" id="Adduser.php" action="<? echo $PHP_SELF?>">
  2.  
  3. <input name="Confirm" value="Confirm" id="Confirm" src="../images/Confirm.jpg" type="image"  alt="add" height="30"  width="73"  style="visibility:hidden"/>
  4.                     <input name="Edit" value="Edit" id="Edit" src="../images/Edit.jpg" type="image"  alt="add" height="30"  width="73" style="visibility:hidden" />
  5.                     <input name="Submit"  id="Submit" src="../images/Submit.jpg" type="image"  alt="add" height="30"  width="73" value="commit" />
  6.  
  7.                     <input 
  8.                     id="Cancel" src="../images/Cancel.jpg" type="image"  alt="cancel" height="30"  width="73" />
  9. </form>
  10.  
Jul 13 '09 #1
3 4199
Dormilich
8,658 Expert Mod 8TB
one way to do it would be posting all values back to the input fields so that you can submit the values again (without further doing), doing an extra "preview" and at the same time inserting the confirm button.

Expand|Select|Wrap|Line Numbers
  1. // generic code
  2. <input name="test" value="$_POST['test']" ... >
  3. ...
  4. if (isset($_POST['submit'])) 
  5. {
  6.     // echo posted vars in a neat way
  7.     echo <input name="confirm" ... >
  8. }
Notes:
- your <form> ID is invalid
- $_SERVER['PHP_SELF']
Jul 13 '09 #2
ghjk
250 100+
I'm sorry. I can't get it.
Jul 13 '09 #3
Dormilich
8,658 Expert Mod 8TB
ok then

step 1
(HTML) write your form as usual (this you should have already done)

step 2
(PHP) write some code to display the submitted values for the user to confirm (no DB action)
this is to be triggered if the submit button is pressed

step 3
take the code of step 1 and insert the posted values as default values*
Expand|Select|Wrap|Line Numbers
  1. <input type="text" name="test"> // step 1
  2. <input type="text" name="test" value="<?php echo postback('test'); ?>">
  3. // value is the input's default value
  4. // postback($index) has to return $_POST[$index] if the submit button was pressed
step 4
insert the confirm button if the submit button is pressed

step 5
(PHP) do the DB action if the confirm button is pressed


* there are endless possibilities to do so only limited by your imagination and capabilities
Jul 13 '09 #4

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

Similar topics

4
by: johnny | last post by:
hi all, I am getting lost in showing data entered in a form to a confirm page. I have a form with as many list/menu as the categories existing in the database. DONE when user choose the items...
16
by: cwizard | last post by:
I'm calling on a function from within this form, and there are values set but every time it gets called I get slammed with a run time error... document.frmKitAmount.txtTotalKitValue is null or not...
5
by: John Bowman | last post by:
Hi, I need some dialog handling help, I must be missing something obvious here but I can't figure out the solution to the following problem... Simple Win Forms app that has button on the form....
4
by: BBFrost | last post by:
We have a data entry application written within Framework 1.0 that contains 20+ custom user controls. The controls overlay each other so that only one custom control is visible at a time. What...
4
by: John | last post by:
Hi all, This really is quite an urgent matter. I have a page with multiple, dynamically-loaded user controls and when a user clicks on a button, the whole form is submitted. Now at this stage...
1
by: DotNetJunkies User | last post by:
I want to include javascript confirm inside the Button_Click even procedure and contine the process based on the user selection. The real problem is how to assign javascript confirm return value to...
7
by: BobRoyAce | last post by:
Let's say I have a text box on a page in which a user is to enter a monetary amount and that I want to ensure that the user enters a value greater than or equal to a certain value that will be...
6
by: Nad | last post by:
Hello, In order to go back to the previous page from a page with possible postbacks I keep Request.Referrer in ViewState and then use it to redirect to the previous page. However I am losing all...
482
by: bonneylake | last post by:
Hey Everyone, Well i am not sure if this is more of a coldfusion problem or a javscript problem. So if i asked my question in the wrong section let me know an all move it to the correct place. ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.