You can't with PHP alone. Simple as that. Seby is wrong.
An option might be to have Javascript fill in an HTML form value ( input type="hidden" or something ) , auto-submit the form with Javascript, or ask the user to submit it.
If the field has been filled in with Javascript, its enabled, othewise, its disabled.