note:
you should use $array["test"] if test is a string
and $array[test] if test is a constant.
do not use $array[test] if you mean the string "test".
$array[test] will also work, if "test" is a string.
Php then tries to look for a constant with name "test",
won't find one and evaluate "test" as string.
But as soon as you define a constant with the name "test",
it won't work as expected:
$array = array();
$array["test"] = "hello";
define("test", "thetest");
$array[test] = "bye";
print_r($array);
will output:
Array
(
[test] => hello
[thetest] => bye
)
This could also happen if the php dev team decides to set a constant
with the name "test". Therefore always use "" for string-keys in arrays.
Regards Michael
"Hunter Vaughn" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Is there any reason I can't just use a JavaScript redirect from a PHP
login
> handling script since I can't seem to get the header("Location: URL");
> function to work? Any security concerns or anything else? As far as I
can
> tell, all calls to header fail as soon as I attain variables based on a
POST
> submission. See example below.
>
> <?
> $username = $_POST[username];
> $password = $_POST[password];
>
> if(some username/password format verification) {
> query the database
> if($password matches pass in database) {
> session_start();
> $email = $Row[0];
> $memberID = $Row[1];
> session_register('email');
> session_register('memberID');
> //header("Location: URL"); This doesn't work.
> print("<script language=\"JavaScript\">window.location =
>
\"http://depts.washington.edu/bionano/HTML/letsboogie22.html\";</script>");
> exit;
> }
> else {
> print("That didn't work...");
> }
> }
> else {
> print("Please enter your username & password.");
> }
> ?>
>
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php