$ key = $ _ REQUEST ['key']不起作用

if (isset($_POST['cancel'])) {
    print("<script>location.href = 'task_led.php'</script>");
}
else if (isset($_POST['assign'])) {
    $atask = $_POST['task'];
    $table_task = $_POST['hid_task'];
    $key = $_REQUEST['key'];

    include 'sql.php';

    $SQL = " ALTER TABLE $table_task ADD $atask VARCHAR(255) NOT NULL";
    mysql_query($SQL);

    $SQL = "UPDATE info SET individ_task = '$atask' WHERE username = '$key'";
    mysql_query($SQL);


    $SQL = "INSERT INTO $table_task (`username`, $atask) VALUES ('$key',     'pending')";
    mysql_query($SQL);

    $SQL = "UPDATE info SET task_status_indi = 'pending' WHERE username = '$key'";
    mysql_query($SQL);

    mysql_close($db_handle);
    print("<script>location.href = 'task_led.php'</script>");
}
else{   

    $namekey = $_REQUEST['key'];
    $user = $_SESSION['username'];
    include 'sql.php';

    $SQL = "SELECT * FROM info WHERE username = '$user'";
    $result = mysql_query($SQL);
    while ($db_field = mysql_fetch_assoc($result)) {
        $grp = $db_field['groups'];//telephone_tech
        $tsk = $db_field['group_task'];//resolve_telephone
    }

    print("<div style='top:167; left:380; position:absolute; z-index:1;'>");
    print("<table border = '0' width = '370' bgcolor = 'white'>");
    print("<tr><td>$tsk</td></tr>");
    print("</table>");
    print("</div>");

    $SQL = "SELECT * FROM task_list WHERE taskname = '$tsk'";
    $result = mysql_query($SQL);
    while ($db_field = mysql_fetch_assoc($result)) {
        $dsc = $db_field['ds'];
    }

    print("<div style='top:200; left:250; position:absolute; z-index:1;'>");
    print("<font face='Broadway' size = '4'>Description:</font>");
    print("</div>");

    print("<div style='top:197; left:380; position:absolute; z-index:1;'>");
    print("<table border = '0' width = '370' bgcolor = 'white'>");
    print("<tr><td>$dsc</td></tr>");
    print("</table>");
    print("</div>");

    print("<div style='top:270; left:350; position:absolute; z-index:1;'>");
    print("<form name='add_form' method='post' action='add_task_led.php'>");
    print("<table border = '0' >");
    print("<tr><td><b>Name:</b></td>");
    print("<td><input name = 'uname' type = 'text' readonly = 'true' value = $namekey></td>");
    print("</tr>");
    print("<tr><td><b>Task:</b></td>");
    print("<td><input name = 'task' type = 'text' value = ''></td>");
    print("<input name = 'hid_task' type = 'hidden' value = $tsk>");
    print("</tr>"); 
    print("<tr>");
    print("<td align = 'right'><input name = 'reset' type = 'reset' value = 'reset'></td>");
    print("<td><input name = 'cancel' type = 'submit' value = 'cancel'>");
    print("<input name = 'assign' type = 'submit' value = 'ASSIGN'></td>");
    print("</tr>");
    print("</table>");
    print("</form>");
    print("</div>");
    mysql_close($db_handle);
}

I need help with this one it is supposed to get the key from URL like nbproject/add_task_led.php?key=Marija to put it in $key variable and it doesn't seem to work. When I put the name directly in this example Marija instead of $key it changes the DB. Am I doing something wrong?

For testing purposes

Can you setup a test table with the following code that I concluded as being successful.

Be sure to change these variables to fit your own, or create them as shown:

$table_task = "table_task"; // table name
$atask = "a_task"; // column name
$db_selected = mysql_select_db('db_name', $db); // db_name is your DB

HTML/PHP/SQL (form action is set to self)

<?php
if (!empty($_REQUEST['key'])) {
  $key = $_REQUEST['key'];
  echo "key: ". $key. "
";

$db = mysql_connect("host","username", "password");

$db_selected = mysql_select_db('db_name', $db);
if (!$db_selected) {
    die ('Can\'t use it : ' . mysql_error());
}

$table_task = "table_task";
$atask = "a_task";

$SQL = "INSERT INTO $table_task (`username`, $atask) VALUES ('$key', 'pending')";
mysql_query($SQL,$db);

// Used for my own testing purposes that you can comment out
// $SQL = "UPDATE $table_task SET a_task = 'pending_test' WHERE username = '$key'";
// mysql_query($SQL,$db);

}
?>

<!DOCTYPE html>
<html>
<head>
<body>

<form action="" method="get">
User: <input type="text" name="key" /><br />
<input type="submit" value="Send" />
</form>

</body>
</html>