Form question (PHP newbie)

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I created a mailform using a page with the form fields (main mail form) and  
a php page with some php-code.
<form method="post" action = "result.php">
I added some validation to my form for the required fields and email  
When a required field is empty the results.php shows a message and the user  
has the possibility to go back to the mailform (link back).
It's also used when sending succeeds.
But when an user goes back, the form is empty (alread filled fields are  
empty again).
Now i'am looking for ((a)nother) possibility to solve this.
For example stay within the main mail form and set the focus on the empty  
field (and/or change text color to red)
I prefer not to use some javscript, because javascript could have been  
disabled .


Re: Form question (PHP newbie)

Quoted text here. Click to load it

You could use your "back-link" as a submit to another form, where you save  
the posted information.

Something like this:

<form method="post" action="backlink.php">
<input type="hidden" name="yourname"  
<input type="hidden" name="youremail"  
<input type="submit" value="Go back">

At your first page, you can just add the write the values to your inputs.

Mvh Kasper Johansen  

Re: Form question (PHP newbie)

Robertico wrote:
Quoted text here. Click to load it

I find it easiest to post the information back to the same forum.  Validate the  
info, and if there are errors, display error messages.  If not, complete the  
mail process and go to the "thank you" page.

A side effect is they don't need to press a button to go back to the form - it's  
already there.

Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.

Re: Form question (PHP newbie)

Kimmo Laine wrote:
Quoted text here. Click to load it

Unless next_page.php generates PHP, the script with this include will
only get HTML.

Quoted text here. Click to load it


    if (isset($_GET['foo'])) {
      echo '<?php echo $_GET[\'foo\']; ?>';
    } else {
      echo '<?php echo \'Not available\'; ?>';

File not found: (R)esume, (R)etry, (R)erun, (R)eturn, (R)eboot

Re: Form question (PHP newbie)

Thx, all of you.


Site Timeline