N
N
nizulko2012-05-28 10:04:48
PHP
nizulko, 2012-05-28 10:04:48

And again about checking for empty (unfilled) fields

Colleagues, there is a script for sending data (mail).
The main part of the code: pastebin.com/53fKyw91
I want to check if the fields are filled in (i.e. if it is not filled out, no information is sent and information is displayed).
I do this: pastebin.com/70bgqLfv - nothing works ...
Direct me on the right path and do not blame me for such a question!
Thanks to!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
S1ashka, 2012-05-28
@S1ashka

isset()

E
eaa, 2012-05-28
@eaa

The first thing that came to hand:

    $err = "";
    if (strlen($_POST['name']) <= 0) {
        $err .= "<p>Заполните поле 'Имя'</p>";
    }
    if (strlen($_POST['subj']) <= 0) {
        $err .= "<p>Заполните поле 'Тема'</p>";
    }
    if (strlen($_POST['msg']) <= 0) {
        $err .= "<p>Заполните поле 'Текст сообщения'</p>";
    }

    if (strlen($err) > 0)
    {
        print ("<center>Ошибка! $err
        <INPUT TYPE='button' VALUE='НАЗАД' onClick='history.go(-1)'>");
    }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question