Here is my code, I dont receive any error, but Im unable to set cookie

Tried using of OB_START too.

Thanks in Advance.

<?php
	include ("../includes/dbcon_.php");
		
	$login_chk_sql = mysql_query("SELECT * FROM TCustomer WHERE UsrName = '$_POST[lusername]' AND LoginPwd = '$_POST[lpassword]'");
	$login_row = mysql_fetch_array($login_chk_sql);
	if ($login_row['IsLoginActivated'] == "N")
	{
		header( 'Location: ../activate_ac.php?aim='.$login_row["IDRK"].'&target='.$login_row["UsrName"] );
	}
	else
	{
		setcookie("LoggedUsrId",$login_row['IDRK'], time()+7200);
		header( 'Location: ../home.php' );
	}
?>

Recommended Answers

Try running a static setcookie in a test script. Also echo your main variables so you can see what they are

Jump to Post

All 2 Replies

Member Avatar

Try running a static setcookie in a test script. Also echo your main variables so you can see what they are

Also is cookies enabled on browser?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.