0

Hi,I put many tiny forms on one of my pages, all have the same action to return to this page when submitted <form method="post" action="<?php echo $_SERVER; ?>">
but how can I know which one was submitted?
I used this line all this time when I had only 1 form
if (isset($_POST)) {...}
I guess I can use a hidden input and give every form different value and then check it..but is this the correct way to do this? or should I give the form an ID? but I'm not sure how to check it later..?

also is it possible to pass hidden values through GET? the purpose of this is to make sure that if a person sees the url he can't access it if he had no access to the previous page that linked to this page, so I'd like to pass hidden values between pages to make sure that ppl can't access pages by just typing urls..

4
Contributors
5
Replies
6
Views
6 Years
Discussion Span
Last Post by Killer.bee
0

I think giving each form a hidden value and then checking them is pretty simple and good solution.
To check if a person has a privilege to view a page I would use cookies where you store required information if user is logged in or anything else - depends on you. Then you check in each page these cookies and if user is unauthorized you just redirect him/her to page where he/she came from =)

0

I think giving each form a hidden value and then checking them is pretty simple and good solution.
To check if a person has a privilege to view a page I would use cookies where you store required information if user is logged in or anything else - depends on you. Then you check in each page these cookies and if user is unauthorized you just redirect him/her to page where he/she came from =)

0

See the difference between GET and POST method is that GET method sends the form value send reflected in URL...Ofter this must be avoided when using secure login...as this may lead to insecurity or backhole left in your code leading to illegal access...
POST methos sends the data but doesn;t reflect in URL...so this method must be used while submitting form...

0

See the difference between GET and POST method is that GET method sends the form value send reflected in URL...Ofter this must be avoided when using secure login...as this may lead to insecurity or backhole left in your code leading to illegal access...
POST methos sends the data but doesn;t reflect in URL...so this method must be used while submitting form...

sorry, I think I didn't explain the question right, I know that for forms always use POST, but for regular links without a form I use GET and I was wondering if I could pass hidden values so that it won't show in the URL when I use the GET and not the POST

thank you

1

You can do that in many ways like:-
1. adding form name or id and using it to check which was submitted
2. adding a hidden field and then checking what's the value in that dfield....

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.