Just do the following at the beginning of the script:
if (isset($cookie_val)) {
setcookie("cookie", $cookie_val, 3600);
echo "Cookie set to $cookie_val.";
} else {
?>
<form action=<%=$PHP_SELF%>>
Enter value: <input type=text name=cookie_val>
<input type=submit value="Go!">
</form>
<?
}
and that will set the cookie 'cookie' to whatever the user entered in the cookie_val textbox.