joasny
18-04-2012, 02:07 PM
Như title mình có đoạn code sau
<?php
include('config.php');
if($_POST['check'])
{
$loginName = $_POST["loginName"];
$result = mysql_query("SELECT * FROM account WHERE loginName LIKE '$loginName' ");
if (mysql_num_rows($result) > 0) {echo "<font color='Red'>Tài khoản này đã được người khác sử dụng.</font> <br /> <a href='javascript:history.go(-1)'>Trở lại</a> <a href='javascript:window.close()'>Thoát</a>";exit;}
else {echo "<font color='Green'>Bạn có thể sử dụng tài khoản này.</font> <br /> <a href='javascript:history.go(-1)'>Trở lại</a> <a href='javascript:window.close()'>Thoát</a>";exit; }
}
?>
<form method="post" action=""><br />
Nhập tài khoản:
<input name="loginName" type="text" /><br />
<input type="submit" name="check" value="Check"/>
<input type="reset" name="reset" value="Reset" /><br />
</form>
Mỗi khi chạy thì nó vẫn hoạt động bình thường nhưng luôn hiện ra
Notice: Undefined index: check in **** on line 8
Ai chỉ mình fix với (bik file cònig.php là truy cập dữ liệu MySQL)
<?php
include('config.php');
if($_POST['check'])
{
$loginName = $_POST["loginName"];
$result = mysql_query("SELECT * FROM account WHERE loginName LIKE '$loginName' ");
if (mysql_num_rows($result) > 0) {echo "<font color='Red'>Tài khoản này đã được người khác sử dụng.</font> <br /> <a href='javascript:history.go(-1)'>Trở lại</a> <a href='javascript:window.close()'>Thoát</a>";exit;}
else {echo "<font color='Green'>Bạn có thể sử dụng tài khoản này.</font> <br /> <a href='javascript:history.go(-1)'>Trở lại</a> <a href='javascript:window.close()'>Thoát</a>";exit; }
}
?>
<form method="post" action=""><br />
Nhập tài khoản:
<input name="loginName" type="text" /><br />
<input type="submit" name="check" value="Check"/>
<input type="reset" name="reset" value="Reset" /><br />
</form>
Mỗi khi chạy thì nó vẫn hoạt động bình thường nhưng luôn hiện ra
Notice: Undefined index: check in **** on line 8
Ai chỉ mình fix với (bik file cònig.php là truy cập dữ liệu MySQL)