
Originally Posted by
Twey
foreach($_POST as $k => $v)
$_SESSION[$k] = $v;[/code]
foreach is a loop
$k = key
$v = value
of the array.. I am sure you have seen this type of notation before, you just didnt know what it meant
Code:
website.com/index.php?do=login&user=boogyman
I am sure you would recognize that alot easier if i put it into this type of format
PHP Code:
$_GET['do'] = 'login';
$_GET['user'] = 'boogyman';
that is using the get method. the post method uses the same principles, but you cannot see the extra characters, you would only see the website.com/search.php
another way to define an array is
PHP Code:
$array("do" =>"login", "user"=>"boogyman");
that explicitly defines the key where an array like this
PHP Code:
$array("login", "boogyman");
would have the defaulted numerical key... so to see the contents of the $array now it would look like this
PHP Code:
$array[0] = "login";
$array[1] = "boogyman";
as you can see it could potentially create lots of problems by having a numerical keyset rather then a custom one. that is why we use the "name" attribute in our forms, so its alot easier to read and instruct the processing of the page faster and more accurately and efficiently.
Bookmarks