create loop to generate array


To start off I am by no means that great with PHP, I know enough to get around. My question is as follows.

How can i create a loop that checks the 4 cookies listed below. If the value of the cookie is 1 (enabled) then it builds the $URL array and includes that one into it. If its 0 then it doesnt include it.

The goal here is to have it generate the array $url and include the link in it if its enabled. So if all 4 cookies were enabled (value of 1) then it would look like this:

[php]$url = array($txn_link.$account_number=>"", $fop_link.$account_number=>"", $admin_tools_link.$account_number=>"", $rc2_link.$account_number=>"");[/php]

[php] if ($_COOKIE[‘fop’] == “1”){

        		$url = array($fop_link.$account_number=>"");

	if ($_COOKIE['admin_tools'] == "1"){

        		$url = array($admin_tools_link.$account_number=>"");

	if ($_COOKIE['txn'] == "1"){

        		$url = array($txn_link.$account_number=>"");

	if ($_COOKIE['rc2'] == "1"){

        		$url = array($rc2_link.$account_number=>"");
Sponsor our Newsletter | Privacy Policy | Terms of Service