Forum Moderators: coopster
if(!isset($_GET['actiune'])) $_GET['actiune'] = '';
if(!isset($_SESSION['user'])) $_SESSION['user'] = '';
if(!isset($_SESSION['localitate'])) $_SESSION['localitate'] = '';
switch($_GET['actiune'])
{
case '':
echo '<table width="309" border="0" cellpadding="0" cellspacing="0">
<form name="formular" action="inregistrare.php?actiune=validare" method="post">
<tr>
<td height="36" colspan="4" valign="top"><h1>Formular inregistrare </h1></td>
</tr>
<tr>
<td width="80" height="19" valign="top"> </td>
<td width="15" rowspan="5" valign="top"></td>
<td width="144" valign="top"> </td>
<td width="70" valign="top"> </td>
</tr>
<tr>
<td height="22" align="right" valign="top">Utilizator:</td>
<td colspan="2" valign="top">
<input type="text" name="user" value="'.$_SESSION['user'].'"> </td>
</tr>
<tr>
<td colspan="2" valign="top">';
echo '<p>Localitate <select name="localitate">';
$cerereSQL = 'SELECT valoare FROM localitate_register';
$rezultat = mysql_query($cerereSQL);
while($rand = mysql_fetch_row($rezultat))
{
print("<option value=\"$rand[0]\">$rand[0]</option>");
}
echo '</select>';
echo' </td>
</tr>
<tr>
<td height="19"> </td>
<td valign="top"></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td height="24"> </td>
<td valign="top"></td>
<td colspan="2" valign="top"><input name="Trimite" type="submit" id="Trimite" value="Trimite">
<input name="Reseteaza" type="reset" id="Reseteaza" value="Reseteaza"> </td>
</tr>
<tr>
<td height="24"> </td>
<td valign="top"></td>
<td> </td>
<td> </td>
</tr>
</form>
</table>';
break;
case 'validare':
$_SESSION['user'] = $_POST['user'];
$_SESSION['localitate']= $_POST['localitate'];
if(($_SESSION['user'] == '') ¦¦ ($_SESSION['localitate'] == ''))
{
echo 'Nu ai introdus date in formular sau cele introduse nu sunt corecte. <br>
Apasa <a href="inregistrare.php">aici</a> pentru a te intoarce la pagina anterioara.';
}
else
{
echo 'Va multumim. <br>
Datele au fost introduse cu succes in baza de date. <br>
Pentru a va autentifica apasati <a href="autentificare.php">aici</a>.';
$cerereSQL = "INSERT INTO `utilizatori` (`utilizator`, `localitate`)
VALUES ('".addentities($_SESSION['user'])."', '".addentities($_SESSION['localitate'])."’)";
mysql_query($cerereSQL);
$_SESSION['user'] = '';
$_SESSION['localitate'] = '';
}
break;
}
?>
if i remove "localitate" field from form everything works great.
the script doesn't return any error.
when i press the submit button i receive the "OK message".
If i want to log in with the new created user i can't because there is no data recorded in the database.
can you help me pls?