Its done using javascript, not php.
in the head of your document add this:
<script language=javascript>
<!--
function formfocus(){document.formname.formfieldname.focus();}
// -->
</script>
Add the following to your body tag:
onLoad=formfocus()
In the function definition, replace "formname" with the name of your form and "formfieldname" with the name of the field you want the cursor to appear in.