I got a html page with 2 forms which are using the same php script..
<?php
    if ($conn) {
        if (isset($_POST['form_student'])) {
            if ($_POST['form_student'] == 'Send') {
                if (!empty($_POST["Ime"]) && !empty($_POST["Prezime"]) && !empty($_POST["BrojIndeksa"]) && !empty($_POST["TipNastave"])) {
                    header('Location: forme.html');
                    echo "<script>alert('Processing data to sql.');</script>";
                } else {
                    echo 'You didnt fill all fields!';
                    echo "<script>alert('You didn't fill all fields!');</script>";
                }
            }
        } 
        if (isset($_POST['form_subject'])) {
            if ($_POST['form_subject'] == 'Send') {
                // same checks just like above with redirecting
                // and displaying alert box
            }
        }
    }
?>
First problem is when I don't fill all fields in, it does work and echo 'You didn't fill al fields!' but doesn't display alert box message, and it only doesn't work when I don't fill all fields. And I'm wonder how can I actually by processing php script, without redirecting to that php script page, show msg box on html page, is it possible with out ajax or jquery, or I should instead using html extension change into php, and do all checks there and avoid processing script into action=""?
 
    