Forum Moderators: coopster

Message Too Old, No Replies

Visual validation of form inputs

Checking form input on a sepperate page before submission to email

         

audaddy

5:33 am on Feb 23, 2007 (gmt 0)

10+ Year Member



Is there a way of having a form post it's fields to a validation page so the user can see what they have submitted, and then click a button to submit the information to email?

Instead of having validating fields in the form, I would like to just submit them to a validation page, so if the information is correct the user can then click a 'submit' button or something.

At the moment I have the information from the form being submitted to email, and the validation page coming up after that. The problem here is that if the information is incorrect the form has to be submitted to email again and I recieve 2 emails instead of just one.

Any suggestions would be appreciated.

Thanks.

David

dreamcatcher

8:46 am on Feb 23, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Sure you can audaddy. :)

Access your post variables on the validation page. Store them in session or hidden vars so they can go back and make changes if necessary. Then, when they are done, submit and send e-mails.

dc

Scally_Ally

8:47 am on Feb 23, 2007 (gmt 0)

10+ Year Member



cant you just swap the pages around?
submit your information to the validation page, validate it and display it to the user storing the vars in a hidden form. then the user submits this validated info to the email page.
Ally

audaddy

9:11 pm on Feb 23, 2007 (gmt 0)

10+ Year Member



Ally, thanks for the reply, and this sounds like what I want, but how do I:

display it to the user storing the vars in a hidden form

I know about hidden fields, but 'storing variables in a hidden form' is past me.

David

jatar_k

10:00 pm on Feb 23, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



you need to make a form that has the same fields from the original form but they are all hidden (except the submit button obviously)

if you han a field called email you could have the hidden field like this

<input type="hidden" name="email" value="<?php echo $_POST['email'];?>">

and you just need 1 hidden field for each field in your form. You echo the value of the $POST array into the value portion of the appropriate form element

dreamcatcher

10:26 pm on Feb 23, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can do a little loop to make sure you catch all your post vars:


foreach ($_POST AS $key => $value)
{

echo '<input type="hidden" name="'.$key.'" value="'.$value.'">'."\n";

}

dc