By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,828 Members | 1,409 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,828 IT Pros & Developers. It's quick & easy.

form processing with input validations

P: n/a
I am creating a form Form1.php that posts to the another form
Form2.php.

I have input validations on the first form. I need the user to go to
the next form ONLY if the inputs from the user are valid. I have not
been able figure out how to do this since the first form always posts
to the next form no matter what.

I would really appreciate if somebody can share their php knowledge
and give me some idea on how this is done in php.

Thanks

Jan 28 '07 #1
Share this Question
Share on Google+
7 Replies


P: n/a
php newbie wrote:
I am creating a form Form1.php that posts to the another form
Form2.php.

I have input validations on the first form. I need the user to go to
the next form ONLY if the inputs from the user are valid. I have not
been able figure out how to do this since the first form always posts
to the next form no matter what.

I would really appreciate if somebody can share their php knowledge
and give me some idea on how this is done in php.

Thanks
Either do validation in the second form, and if it fails, send them back
to the first form. Or, post to the first form and validate there. If
it succeeds, go to the second form.

Either way, you can save data in the $_SESSION for later retrieval.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Jan 28 '07 #2

P: n/a
Thanks for a prompt reply. Is there a way to achieve this same result
without using session?
Any ideas!!

On Jan 28, 12:54 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
php newbie wrote:
I am creating a form Form1.php that posts to the another form
Form2.php.
I have input validations on the first form. I need the user to go to
the next form ONLY if the inputs from the user are valid. I have not
been able figure out how to do this since the first form always posts
to the next form no matter what.
I would really appreciate if somebody can share their php knowledge
and give me some idea on how this is done in php.
ThanksEither do validation in the second form, and if it fails, send them back
to the first form. Or, post to the first form and validate there. If
it succeeds, go to the second form.

Either way, you can save data in the $_SESSION for later retrieval.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================
Jan 28 '07 #3

P: n/a
Rik
php newbie <ar******@gmail.comwrote:
On Jan 28, 12:54 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
>php newbie wrote:
I am creating a form Form1.php that posts to the another form
Form2.php.
I have input validations on the first form. I need the user to go to
the next form ONLY if the inputs from the user are valid. I have not
been able figure out how to do this since the first form always posts
to the next form no matter what.
I would really appreciate if somebody can share their php knowledge
and give me some idea on how this is done in php.
ThanksEither do validation in the second form, and if it fails, send
them back
to the first form. Or, post to the first form and validate there. If
it succeeds, go to the second form.

Either way, you can save data in the $_SESSION for later retrieval.

Thanks for a prompt reply. Is there a way to achieve this same result
without using session?
Any ideas!!
You can make hidden inputs in the second form, so it will contain the
information of the first. This means that you will have to revalidate the
data from the first form when the user submits the second form though.
--
Rik Wasmus
Jan 28 '07 #4

P: n/a
Rik wrote:
php newbie <ar******@gmail.comwrote:
>On Jan 28, 12:54 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
>>php newbie wrote:
I am creating a form Form1.php that posts to the another form
Form2.php.

I have input validations on the first form. I need the user to go to
the next form ONLY if the inputs from the user are valid. I have not
been able figure out how to do this since the first form always posts
to the next form no matter what.

I would really appreciate if somebody can share their php knowledge
and give me some idea on how this is done in php.

ThanksEither do validation in the second form, and if it fails,
send them back
to the first form. Or, post to the first form and validate there. If
it succeeds, go to the second form.

Either way, you can save data in the $_SESSION for later retrieval.

Thanks for a prompt reply. Is there a way to achieve this same result
without using session?
Any ideas!!

You can make hidden inputs in the second form, so it will contain the
information of the first. This means that you will have to revalidate
the data from the first form when the user submits the second form though.
--Rik Wasmus
The problem with this is you can't automatically go back to the first
form from the server alone. A header redirection statement won't send
the data in the hidden values.

You could do it with javascript - if the user has javscript running.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Jan 28 '07 #5

P: n/a
php newbie wrote:
On Jan 28, 12:54 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
>php newbie wrote:
>>I am creating a form Form1.php that posts to the another form
Form2.php.
I have input validations on the first form. I need the user to go to
the next form ONLY if the inputs from the user are valid. I have not
been able figure out how to do this since the first form always posts
to the next form no matter what.
I would really appreciate if somebody can share their php knowledge
and give me some idea on how this is done in php.
ThanksEither do validation in the second form, and if it fails, send them back
to the first form. Or, post to the first form and validate there. If
it succeeds, go to the second form.

Either way, you can save data in the $_SESSION for later retrieval.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================

Thanks for a prompt reply. Is there a way to achieve this same result
without using session?
Any ideas!!
(Top posting fixed)

You can use other way - like javascript. But sessions are the easiest.
They are really simple to use.

P.S. Please don't top post. Thanks.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Jan 28 '07 #6

P: n/a
Rik
Jerry Stuckle <js*******@attglobal.netwrote:
Rik wrote:
>php newbie <ar******@gmail.comwrote:
>>On Jan 28, 12:54 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
php newbie wrote:
I am creating a form Form1.php that posts to the another form
Form2.php.

I have input validations on the first form. I need the user to go to
the next form ONLY if the inputs from the user are valid. I have not
been able figure out how to do this since the first form always
posts
to the next form no matter what.

I would really appreciate if somebody can share their php knowledge
and give me some idea on how this is done in php.

ThanksEither do validation in the second form, and if it fails,
send them back
to the first form. Or, post to the first form and validate there. If
it succeeds, go to the second form.

Either way, you can save data in the $_SESSION for later retrieval.
Thanks for a prompt reply. Is there a way to achieve this same result
without using session?
Any ideas!!
You can make hidden inputs in the second form, so it will contain the
information of the first. This means that you will have to revalidate
the data from the first form when the user submits the second form
though.
--Rik Wasmus

The problem with this is you can't automatically go back to the first
form from the server alone. A header redirection statement won't send
the data in the hidden values.

You could do it with javascript - if the user has javscript running.
That's one of the reasons for me to keep several forms in one script (or a
main script that includes several forms). All the
data/requirements/validation is there, and served up based on input.
--
Rik Wasmus
Jan 28 '07 #7

P: n/a
On Sun, 28 Jan 2007 11:23:42 -0800, php newbie <ar******@gmail.comwrote:
>php newbie wrote:
I am creating a form Form1.php that posts to the another form
Form2.php.
I have input validations on the first form. I need the user to go to
the next form ONLY if the inputs from the user are valid. I have not
been able figure out how to do this since the first form always posts
to the next form no matter what.
I would really appreciate if somebody can share their php knowledge
and give me some idea on how this is done in php.
ThanksEither do validation in the second form, and if it fails, send
them back
to the first form. Or, post to the first form and validate there. If
it succeeds, go to the second form.

Either way, you can save data in the $_SESSION for later retrieval.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================

On Jan 28, 12:54 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:

Thanks for a prompt reply. Is there a way to achieve this same result
without using session?
Any ideas!!
(Changed topposting to bottomposting)

There's really no reason to not use sessions here. However, to address the
previous concern that you can't use a header redirect to send the original
data back to the first form, you could simply use fsockopen to send a POST
request with (altered/validated) data, and have the PHP on the first form
display any default values that have been POST'ed.

This is really much more of a hassle than sessions. PHP will even
automatically try and send a session cookie by default, but if it can't,
it will use the query string.

--
Curtis
Feb 1 '07 #8

This discussion thread is closed

Replies have been disabled for this discussion.