|
|
|
|
||||||
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Hello, a stupid question but...
page_A.php is a page with a form. The user inserts text in four fields, then he clicks a submit button. The data goes to page_B.php: this page controls the data submitted, then echoes a message. If there were problems with the submitted data the message says: "a problem occurred with your data. Click here to come back to the form" (page_A.php). When the user comes back, he finds the fields white. How can I do to show him what he submitted? Thanks! |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
..oO(pepper.gabriela@gmail.com)
>page_A.php is a page with a form. >The user inserts text in four fields, then he clicks a submit button. >The data goes to page_B.php: >this page controls the data submitted, then echoes a message. >If there were problems with the submitted data the message says: >"a problem occurred with your data. Click here to come back to the >form" (page_A.php). >When the user comes back, he finds the fields white. You don't need two pages. Let page_A show and handle the form processing. Submit the form to the same page, check the values and show the form again if there's an error. To keep the form data while moving from one page to another you would have to store the values in a session. Micha |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
On Sep 14, 6:39 pm, Michael Fesser <neti...@gmx.de> wrote:
> To keep the form data while moving from one page to another you would > have to store the values in a session. > > Micha Ok, I'll use sessions, thanks! |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
pepper.gabriela@gmail.com wrote:
> Hello, a stupid question but... > > page_A.php is a page with a form. > The user inserts text in four fields, then he clicks a submit button. > The data goes to page_B.php: > this page controls the data submitted, then echoes a message. > If there were problems with the submitted data the message says: > "a problem occurred with your data. Click here to come back to the > form" (page_A.php). > When the user comes back, he finds the fields white. > > How can I do to show him what he submitted? > > Thanks! > > Create a form on page B. Copy all of the $_POST variables into hidden fields with a submit button that says, "Go Back." -- ***************************** Chuck Anderson • Boulder, CO http://www.CycleTourist.com ***************************** |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
If you put them in the same page, it will be better for you. It will
ease the process. [php] if (isset($_POST['submit'])) { # Process the form if ($number_of_errors_in_the_form != 0) { # Show the errors # Display the Form Again. # Example: print "<input type='text' name='fieldname' value='". $_POST['fieldname']."' />"; } else { # Tell the user everything went fine. } } else { # Display the form. } |
|
|
|
#6 |
|
Messages: n/a
Hébergeur: |
> > Create a form on page B. Copy all of the $_POST variables into hidden > fields with a submit button that says, "Go Back." > hi chuck, it sounds interesting (I imagine form on page B should point page A), but what if the user clicks the back button of his browser? |
|
|
|
#7 |
|
Messages: n/a
Hébergeur: |
pepper.gabriela@gmail.com wrote:
>> Create a form on page B. Copy all of the $_POST variables into hidden >> fields with a submit button that says, "Go Back." >> >> > > > > hi chuck, it sounds interesting (I imagine form on page B should point > page A), but what if the user clicks the back button of his browser? > > Yes, the form action on page B is to return to page A. Clicking the Back button is fine. The browser loads the previous state of page A, with the form fields still filled out. I've even written a function that reads all of the elements in an array (e.g., $_POST) and creates hidden form fields for each one. It can even handle multi-dimensional arrays (e.g., $_POST variables that are themselves, an array). -- ***************************** Chuck Anderson • Boulder, CO http://www.CycleTourist.com The world is my country, Science, my religion. ***************************** |
|
|
|
#8 |
|
Messages: n/a
Hébergeur: |
Chuck Anderson wrote:
> pepper.gabriela@gmail.com wrote: >>> Create a form on page B. Copy all of the $_POST variables into hidden >>> fields with a submit button that says, "Go Back." >>> >>> >> >> >> >> hi chuck, it sounds interesting (I imagine form on page B should point >> page A), but what if the user clicks the back button of his browser? >> >> > > Yes, the form action on page B is to return to page A. > > Clicking the Back button is fine. The browser loads the previous state > of page A, with the form fields still filled out. > It will if you have the browser caching the page and haven't needed to flush the cache. But you shouldn't depend on that behavior. > I've even written a function that reads all of the elements in an array > (e.g., $_POST) and creates hidden form fields for each one. It can even > handle multi-dimensional arrays (e.g., $_POST variables that are > themselves, an array). > That's the best way to handle things. -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ================== |
|
![]() |
| Outils de la discussion | |
|
|