I have a page with a basic form (only 1 input) and want to autofocus on that field. When the page loads it is not focused, but if I hit f5 to refresh it will focus. Not sure if this is related, but the form is in a table for css formatting I have applied to the whole website. See below for the code I have used:
if (!isset($_POST['stage'])){
// Starting point, enter lab ref
echo"<form action='recieveasample.php' method='POST'>
<table><tr><td>
Enter Lab Ref </td><td>
<input name='labref' autofocus='autofocus' required='required'></input> </td></tr>
<tr><td colspan='2'> <input type='submit' value='NEXT'></input> </td></tr></table>
<input type='hidden' name='stage' value='labref'></input>
</form>";
}elseif(....next step...