A simple syntax question

Okay simple for someone who knows more than me, which is basically all of you, LOL.

What I have is:


        echo "<input type=\\"checkbox\\" name=\\"agent_id[]\\" value=\\"".$tmp["ID"]."\\" />"; 
		echo((in_array("".$tmp["ID"]."", explode(", ", $row_WADAtest_table['agent_id'])))?"checked=checked":""); echo $tmp['name'];
	    echo "<br />"; 

Correct me if I am wrong but I think I need to figure out how to get the second echoed line into the first line after the value= so that the echoed ‘checked=checked’ is placed in the correct spot. I have been trying to figure this out for hours now and I am just so frustrated now. I can’t wait to find out how simple it would have been if I would have known what I was doing.

Thanks ahead of time for your response.

For how you need it that’s about as simple as it gets, you don’t need the extra brackets and double quotes in the line though

$checkd = in_array($tmp["ID"], explode(", ", $row_WADAtest_table['agent_id'])) ? "checked=checked" : "";

Ahhh, I think I figured it out! Please let me know if this is the right solution. It appears to be working so I hope so.


	$checkd = ((in_array("".$tmp["ID"]."", explode(", ", $row_WADAtest_table['agent_id'])))?"checked=checked":"");
		echo "<input type=\\"checkbox\\" name=\\"agent_id[]\\" value=\\"".$tmp["ID"]."\\" {$checkd} />";  echo $tmp['name'];
	    echo "<br />";