Jump to content

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


Recommended Posts

Posted

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

Posted

<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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • 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.