Asked by duncanb7
at 2024-05-07 02:29:22
Point:500 Replies:8 POST_ID:828551USER_ID:11059
Topic:
PHP Scripting Language;Hypertext Markup Language (HTML);JavaScript
From the following set cookies php script from google seach example, I have quetion
Question-1
why the cookies.php as follow will re-run again after form is submitted ?
I just make echo statment on the top of the code to test
the script is re-run again.
In first run, when user type http://www.mywebsite.com/cookies.php, it will
echo out on IE and display Null at $user variable
echo "user variable is changing to =
And then I submit the form after typing username and click radio button
it will echo out in IE and display
echo "user variable is changing to = myusername
Whether when click submit button with method="POST", it will let the php
script re-run again ?
Question-2
Why it uses $user = $_POST['user'] ? And not $_SESSION['user']
When we will use $_SESSION and $_POST ?
Please advise
Duncan
The following code is in file of cookies.php
Question-1
why the cookies.php as follow will re-run again after form is submitted ?
I just make echo statment on the top of the code to test
the script is re-run again.
In first run, when user type http://www.mywebsite.com/cookies.php, it will
echo out on IE and display Null at $user variable
echo "user variable is changing to =
And then I submit the form after typing username and click radio button
it will echo out in IE and display
echo "user variable is changing to = myusername
Whether when click submit button with method="POST", it will let the php
script re-run again ?
Question-2
Why it uses $user = $_POST['user'] ? And not $_SESSION['user']
When we will use $_SESSION and $_POST ?
Please advise
Duncan
The following code is in file of cookies.php