Nasıl geri istemci sunucu tarafı doğrulama mesajları geçmek için?

0 Cevap

I have the following two script files (i.e., formtest.html and calc.php). When I do the server side validation on calc.php, how do I pass the error message (i.e. $err_msg back to the formtest.html?

Teşekkür ederim

<html>
    <head>
        <title>Form Test</title>
    </head>
    <body>

    <form method="post" action="calc.php">
    <pre>
          Loan Amount <input type="text" name="principle" />
                      <input type="submit" />
    </pre>
    </form>
    </body>
    </html>

.

// calc.php

        $err_msg = ''; 

        if ( !empty(isset($_POST['principle'])) )
        {
            // process the form and save to DB
        } else {
         $err_msg .= 'Loan Amount is empty!';
        }

        ?>

0 Cevap