Good day. I can not understand how to correctly check the form in php.
<!-- Область основного контента --> <form action='calc.php' method="get"> <label>Число 1:</label> <br /> <input name='num1' type='text' /> <br /> <label>Оператор: </label> <br /> <input name='operator' type='text' /> <br /> <label>Число 2: </label> <br /> <input name='num2' type='text' /> <br /> <br /> <input type='submit' value='Считать'> </form> <!-- Область основного контента --> <?php // var_dump($_GET); if (empty($_GET)){ return 'Ничего не передано!'; } if (empty($_GET['num1'])|| empty($_GET['num2'])) { return 'Не переданы аргументы!'; } if (empty($_GET['operator'])) { return 'Не передана операция'; } ?> Interested in such questions: 1) Can I return the result via return or write via echo? 2) When I wrote through echo, the second and third checks worked, but 1 never worked ...
method="post"because get zahlomit you search bar - Ruslan Semenov