Yes, you can use the Apple Pencil 2 to collect information in a web page.
Yes, it can also be used to fill out
<textarea> fields. However, it might not be in the manner that you imagine. If you're hoping that all browsers convert handwriting into computer text when you "draw" on top of an
<input> - then you're unfortunately wrong. Instead you'll be able to use a virtual keyboard with the pen to enter text into
<textarea> form fields.
Yes, you can use use Apple Pencil 2 to create files that can be "attached" (i.e. uploaded) from a web page. There's both built-in apps as well as third party apps that allows you to create PDFs, image files, etc. on iPads. These files could for example contain drawings made with the pencil. Browsers support the standard
<input type="file"> field for uploads on the iPad.
If you want the user to be able to use handwriting directly on your web page without having to create PDFs or image files, then you can use the
<canvas> element. You can easily find many tutorials on how to use the