Hi All, I have a HTML form (lots of input fields). I want to provide form preview to the user before sending all the values to the database. I can do that by redirecting to some another page or on same page and provide a back and submit button. When user clicks on submit button, I need to store all the values to the the databse. Do I need to store all the values in a hidden fields? If there is any other way, please provide me any pointers. Thanks in advance!! Best Regards, Inderpal Singh
If you are giving the user a preview form you need to populate the form with the previous values. I use this technique to deal with errors in forms before they are finally submitted. For instance, when the form is first displayed the name input section looks like this: <input type="text" name="name" size="25" value="" /> When the form is previewed, it is redisplayed to the user like this: <input type="text" name="name" size="25" value="Inder Pal" /> In your php code you might have a variable called $userName and it might be sset thusly: $userName = ""; if(!empty( $_POST['name'] )) { $userName = $_POST['name']; } In section of the script with displays the form, you might write: <input type="text" name="name" size="25" value="<?php echo $userName; ?>" /> -- or -- echo '<input type="text" name="name" size="25" value="' . $userName . '" />';
Yes it's right, but for better prview option ,,, You can post this form to another page for preview..and all forms valuse will store in hidden field.. If users say Confirm then it will insert all form value into database otherwise just cancel the registration and let's redirect it to any wanted page..
Yes it's right, but for better prview option ,,, You can post this form to another page for preview..and all forms valuse will store in hidden field.. Here you show values for user confiramtion. If users say Confirm then it will insert all form value into database otherwise just cancel the registration and let's redirect it to any wanted page..