Cod: Selectaţi tot
<?php
if (isset($_POST['submit'])) {
require_once "data/dbase.php";
mysql_connect($host, $username, $password)or die("cannot connect");
mysql_select_db($db_name)or die("cannot select DB");
$text2 = $_POST['text'];
$result = mysql_query("SELECT * FROM verifica WHERE cod = '$text2'");
if (mysql_num_rows($result) > 0) {
echo "text valid";
} else {
echo "text invalid";
}
} else {
echo "<form method='post' action=''>";
echo "<div>
<div style='width: 500px; padding: 3px; margin-bottom: 5px;'>
<div style='width: 220px; float:left;'>Verifica cod:</div>
<div style='width: 280px; float:left;'><input class='box' name='text' value=''/></div>
</div>
<div style='width: 400px; padding: 3px; margin-bottom: 5px;'>
<div style='width: 120px; float:left;'> </div>
<div style='width: 280px; float:left;'><input type='submit' name='submit' class='buton' value='Verifica' /></div>
</div>
</div>
</form>";
}
?>
