doomed2020 — 2012-02-19T15:09:14-05:00 — #1
If a form was submitted without any proper method , how can we grab that particular information on the other side ?
For example :
<form action="process.php" method="">
Userame: <input type="text" name="userName" />
Password: <input type="password" name="pass" />
<input type="submit" name="submit" value="submit"
$userName = $_REQUEST['userName'];
$password = $_REQUEST['pass'];
echo ("Welcome " . $username . " to our page.");
Now what if a user deliberately alters the method, and uses "$POST or $GET or Leaves it blank. How can I can make it fool proof on the server side without using the $_REQUEST Global Variable?
Is there any other way to grab that submitted information like in $_SERVER Global Variable ?
*For those who think the form will not submit without disclosing the method, then they must try this after disabling their Java-script.
I hope you understand my question and would reply me in as detail as possible.
logic_earth — 2012-02-19T16:26:20-05:00 — #2
You use $GET or $POST, if the form is not submitted in a way you expect then you ignore it.
It is that easy.
csu_bill — 2012-02-19T21:41:30-05:00 — #3
You should program to use what you want.
You should complete the form tag to be:
<form action="process.php" method="post">
if that is the method you want to use.
michael_morris1 — 2012-02-19T22:07:47-05:00 — #4
Browsers default to post if the method is not specified.