Jump to content

Cum Adaug Un Nou Cod Pentru Adaugare Eroare (Nume Deja Ales)


adytzul89

Recommended Posts

Am un formular facut in php, insa vreau sa adaug, in care un vizitator care completeaza formularu, in casuta subdomeniu, un nume: abc, vreau sa dea eroare, numele este folosit .. sper ca ati inteles.

exemplul din formular, cum adaug aici:

 if (!empty($_POST['subdomeniu'])) {

            $subdomeniu = stripslashes(strip_tags($_POST['subdomeniu']));

            $_SESSION['subdomeniu'] = $subdomeniu;

        } else {

            $subdomeniu = NULL;

            $_SESSION['subdomeniu'] = '';


            $erori[] = 'Nu ati completat campul <strong>Subdomeniu</strong>.';

        }

vreau sa mai adaug aici ca sa dea eroarea, numele ales este deja folosit, multumesc frumos

Link to comment
Share on other sites


<form action="" method=post>

Subdomeniu: <input type=text name=subdomeniu><br>

<input type=submit name=submit value=Trimite>

</form>


<?php

if(isset($_POST['submit'])) {

if(isset($_POST['subdomeniu']) && empty($_POST['subdomeniu'])) { echo "Nu ai completat campul !"; }

if(isset($_POST['subdomeniu']) && !empty($_POST['subdomeniu'])) {

$_SESSION['subdomeniu'] = $_POST['subdomeniu'];

echo "Subdomeniul este: ".$_SESSION['subdomeniu'];

// alte actiuni

}

}

?>

"Timpul exista pentru ca lucrurile sa nu se intample in acelasi timp." - Albert Einstein

"I'm gonna make him an offer he can't refuse." - Don Corleone Vito

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.