php – Create a form that redirects to the network site?

I just created a page in my multisite network where the user can enter a site name and be redirected to the site.
It works fine, but if there is a typo or they enter a site that does not exist, it will redirect them anyway.

Is it possible to perform a check of network sites to see if there is before redirection, and if that is not the case, generate an error?

Here's what I have for now:

<form name = "linkform" id = "linkform" method = "post" onsubmit = "location.href = & # 39;/ + # Document.getElementById (& nbsp; name of the site & # 39;). value; returns false; ">