Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to make a validation registration in php?
    primarykey
    data
    text
    <pre><code> &lt;form method="post" action="ins.php"&gt; &lt;div class="reg_section personal_info"&gt; &lt;h3&gt;Informatii generale&lt;/h3&gt; &lt;input name="Nume" type="text" required id="Nume" placeholder="Nume" &gt; &lt;input name="Prenume" type="text" required id="Prenume" placeholder="Prenume"&gt; &lt;input name="Login" type="text" required id="Login" placeholder="Login"&gt; &lt;input name="Email" type="text" required id="Email" placeholder="Email"&gt; &lt;input name="date" type="text" required id="date" placeholder="Data Nasterii"&gt; &lt;/div&gt; &lt;div class="reg_section password"&gt; &lt;h3&gt;Parola&lt;/h3&gt; &lt;input name="password" type="password" required id="password" placeholder="Parola"&gt; &lt;input name="password1" type="password" required id="password1" placeholder="Confirma parola"&gt; &lt;/div&gt; &lt;div class="reg_section password"&gt; &lt;h3&gt;Regiunea&lt;/h3&gt; &lt;select&gt; &lt;option value="Nord"&gt;Nord&lt;/option&gt; &lt;option value="Sud"&gt;Sud&lt;/option&gt; &lt;option value="Centru"&gt;Centru&lt;/option&gt; &lt;/select&gt; &lt;/div&gt; &lt;/p&gt; &lt;p class="submit"&gt;&lt;input type="submit" name="commit" value="Sign Up"&gt;&lt;/p&gt; &lt;/form&gt; if(isset($_POST['submit'])){ if(empty($_POST['Nume'])) { $_POST['numeEr']="Introduceti Numele!"; } else if (!preg_match("/^\w{3,}$/", $_POST['Nume'])) { $_POST['numeEr']="Ati introdus valori gresite! Numele trebuie sa fie compus din caractere"; } else if(empty($_POST['Prenume'])) { echo '&lt;br&gt;&lt;font color="red"&gt;&lt;img border="0" src="error.gif" align="middle" alt="Introduceti Numele!"&gt; Introduceti Numele! &lt;/font&gt;'; } else if (!preg_match("/^\w{3,}$/", $_POST['Prenume'])) { echo '&lt;br&gt;&lt;font color="red"&gt;&lt;img border="0" src="error.gif" align="middle" alt="Ati introdus valori gresite!"&gt; Ati introdus valori gresite! Numele trebuie sa fie compus din caractere&lt;/font&gt;'; } else if(empty($_POST['Login'])) { echo '&lt;br&gt;&lt;font color="red"&gt;&lt;img border="0" src="error.gif" align="middle" alt="Introduceti Loginul!"&gt; Introduceti Loginul! &lt;/font&gt;'; } else if (!preg_match("/^\w{3,}$/", $_POST['Login'])) { echo '&lt;br&gt;&lt;font color="red"&gt;&lt;img border="0" src="error.gif" align="middle" alt="Ati introdus valori gresite!"&gt; Ati introdus valori gresite! Loginul trebuie sa fie compus din caractere&lt;/font&gt;'; } else if(empty($_POST['password'])) { echo '&lt;br&gt;&lt;font color="red"&gt;&lt;img border="0" src="error.gif" align="middle" alt="Introduceti Parola!"&gt; Introduceti parola&lt;/font&gt;'; } elseif (!preg_match("/\A(\w){6,20}\Z/", $_POST['password'])) { echo '&lt;br&gt;&lt;font color="red"&gt;&lt;img border="0" src="error.gif" align="middle" alt="Parrola este prea scurta!"&gt; Parrola trebuie sa fie mai &gt; 6 caractere! &lt;/font&gt;'; } else if(empty($_POST['password1'])) { echo '&lt;br&gt;&lt;font color="red"&gt;&lt;img border="0" src="error.gif" align="middle" alt="Confirmati Parola"&gt; Conformati parola!&lt;/font&gt;'; } else if($_POST['password'] != $_POST['password1']) { echo '&lt;br&gt;&lt;font color="red"&gt;&lt;img border="0" src="error.gif" align="middle" alt="Parolele nu coincid!"&gt; Parolele nu coincid!&lt;/font&gt;'; } else if(empty($_POST['email'])) { echo '&lt;br&gt;&lt;font color="red"&gt;&lt;img border="0" src="error.gif" align="middle" alt="Introduce-ti E-mail-ul!"&gt;Introduce-ti E-mail-ul! &lt;/font&gt;'; } else if (!preg_match("/^[a-zA-Z0-9_\.\-]+@([a-zA-Z0-9\-]+\.)+[a-zA-Z]{2,6}$/", $_POST['email'])) { echo '&lt;br&gt;&lt;font color="red"&gt;&lt;img border="0" src="error.gif" align="middle" alt="E-mail are format incorect!"&gt; E-mail are format incorect! &lt;/font&gt;'; } else{ $nume = $_POST['Nume']; $prenume = $_POST['Prenume']; $login = $_POST['Login']; $parola=$_POST['password']; $parola = md5($parola); $parola1=$_POST['password1']; $email = $_POST['email']; $data = $_POST['date']; $query = ("SELECT id FROM utilizatori WHERE Login='$login'"); $sql = mysql_query($query) or die(mysql_error()); if (mysql_num_rows($sql) &gt; 0) { echo '&lt;font color="red"&gt;&lt;img border="0" src="error.gif" align="middle" alt="Loginul dat exista"&gt;Exista deja un utilizator cu Login-ul dat!&lt;/font&gt;'; } else { $query2 = ("SELECT id FROM users WHERE Mail='$email'"); $sql = mysql_query($query2) or die(mysql_error()); if (mysql_num_rows($sql) &gt; 0){ echo '&lt;font color="red"&gt;&lt;img border="0" src="error.gif" alt="Exista deja un Utilizator cu aces email!"&gt;Exista deja un Utilizator cu aces email!&lt;/font&gt;'; } else{$res=mysql_query("INSERT INTO utilizatori (Nume,Prenume,Login,Parola,Data_nasterii,Mail) VALUES ('$nume','$prenume','$login','$parola','$data','$email')") or die(mysql_error()); header('location:index(2).php'); } }}} include 'inregistrare.php'; ?&gt; </code></pre> <p>here is my form and connection! How can I make warnings to appear in form in the same time? I tried many ways but nothing works, how can I correctly make this validation?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload