Jump to content
Sign in to follow this  

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

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

Share this post

Link to post
Share on other sites

<form action="" method=post>

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

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



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

Share this post

Link to post
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.

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.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...