Good day! There is a html form. It is necessary that after clicking on the button that sends the form, there is a redirect. those. The redirect should depend on what data the user enters (if the check returns true , then the user should be transferred to the page, say, auth.php . If false , the user should remain on the input page and get a warning window). I wonder how this can be done in php, and is it even possible to do this, since if we use header (), we will get an error.
if we use header (), we will get an error
Well, correct this error and the whole business. Most likely, by the time you are trying to send a new header through the header, php has already sent part or all of the page to the browser. And headers as you know after sending the page can not be transferred. The easiest solution would be at the very top of the script, immediately after <? Php, insert the line ob_start (); And at the very bottom, before?>, Add echo ob_get_clean ();