// Set a cookie that expires in one hour
setcookie("userName", $name, time()+3600);
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
A cookie was set on this page, and will be active when
the client has sent the cookie back to the server.
I think you'll have problems doing this if I understand what you're saying.
The contents of the iframe is from a different server/domain from the main the iframe is on right? Well IE has a privacy feature that stops accepting cookies from domains other than the one which is in the main window. You can control this in the security/privacy settings in IE but then you need to ask your users to do this.