Correct line: > setcookie ("user_reg[1]" , "$pass_w", $lifetime, "/", ".mydotcom.com"); Now look at this line: > setcookie ("user_reg[2]" , "$full_name", $lifetime, ".mydotcom.com"); Don't you just hate it when you forget a "/"? ;) -- Plutarck Should be working on something... ...but forgot what it was. ""PHPretard"" <[EMAIL PROTECTED]> wrote in message 001501c0bb17$09f7f1a0$1983bc18@pixeldesire">news:001501c0bb17$09f7f1a0$1983bc18@pixeldesire... > hi peoples, Im going insane here, I have this script working great except > two things ... > for one , the sql query returns an error that couldnt run the query... > and the second is that the variable $user_reg[2] holds nothing even though > I cheked the html form and also checked the cookie variable and all are set > except [2] . > > heres my script snippet: > > -- > ... > $user_reg[0] = $user_name; > $user_reg[1] = $pass_w; > $user_reg[2] = $full_name; > $user_reg[3] = $email; > $user_reg[4] = $age; > $user_reg[5] = $icq; > $user_reg[6] = $aim; > > function add_newuser() { > $date = gmdate ( "M d Y H:i:s" ); > $sql = "INSERT INTO mytable (user_name, pass_w, full_name, email, > age, icq, aim, date) VALUES ('$user_reg[0]', '$user_reg[1]', '$user_reg[2]', > '$user_reg[3]', '$user_reg[4]', '$user_reg[5]', '$user_reg[6]', '$date')"; > $connection = mysql_connect("localhost", "mylog", "mypass") or die > ("Could not connect to database"); > $db = mysql_select_db("mydb",$connection); > $sql_result = mysql_query($sql, $connection) or die ("Couldnt run > query"); > } > ?> > <? > if (isset($newuse) AND $newuse == "yes") { > $lifetime = time() + 180 * 86400; > setcookie ("user_reg[0]" , "$user_name", $lifetime, "/", > ".mydotcom.com"); > setcookie ("user_reg[1]" , "$pass_w", $lifetime, "/", ".mydotcom.com"); > setcookie ("user_reg[2]" , "$full_name", $lifetime, ".mydotcom.com"); > setcookie ("user_reg[3]" , "$email", $lifetime, "/", ".mydotcom.com"); > setcookie ("user_reg[4]" , "$age", $lifetime, "/", ".mydotcom.com"); > setcookie ("user_reg[5]" , "$icq", $lifetime, "/", ".mydotcom.com"); > setcookie ("user_reg[6]" , "$aim", $lifetime, "/", ".mydotcom.com"); > add_newuser(); > -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]