HI,
I want to add a line to this code to see if the text box username is not blank, if it is blank it will show a error and stop it so it does not add to the database!! if it's got something in it it will continue with the code
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta http-equiv="Content-Language" content="en-nz">
<title>Rugby League in New Zealand</title>
<meta name="keywords" content="New Zealand Warriors, New Zealand Kiwis, New Zealand Rugby League, Rugby League, NZRL, Bartercard Cup">
<meta name="description" content="Rugby League in New Zealand from th grass roots to the Warriors and the Kiwis.">
</head>
<link rel="stylesheet" type="text/css" href="http://nz.rleague.com/includes/rugbyleaguenz.css">
<body bgcolor="#C0C0C0" topmargin="1" leftmargin="1" marginwidth="1" marginheight="1">
<div align="center">
<table border="1" cellspacing="0" style="border-collapse: collapse" width="765" id="table1" bgcolor="#000000">
<tr>
<td>
<table border="0" style="border-collapse: collapse" width="100%" id="table2" cellpadding="0">
<tr>
<td>
<table border="0" style="border-collapse: collapse" width="100%" id="table4">
<tr>
<td><?php
require("../includes/header.php");
?></td>
</tr>
<tr>
<td><?php
require("../includes/menu.php");
?> </td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table border="0" style="border-collapse: collapse" width="100%" id="table3">
<tr>
<td width="150" align="left" valign="top"><?php
require("../includes/leftmenu.php");
?> </td>
<td bgcolor="#FFFFFF">
<font size="1" face="Verdana" color="#000000">
<p></p>
<hr color="#000000" width="97%" size="1">
<div align="center">
<table border="0" style="border-collapse: collapse" width="97%" id="table5">
<tr>
<td><font face="Verdana" size="2">
<?php
mysql_connect (localhost, user, pass);
mysql_select_db (table);
?>
<?php
$check = "select id from members where username = '".$_POST['username']."';";
$qry = mysql_query($check) or die ("Could not match data because ".mysql_error());
$num_rows = mysql_num_rows($qry);
if ($num_rows != 0) {
echo "Sorry, there the username $username is already taken.<br>";
echo "<a href=signup.php>Try again</a>";
} else {
$result = mysql_query ("INSERT INTO members ( `id`,`username`,`firstname`,`lastname`,`dob`,`address`,`city`,`country`,`phone`,`email`,`password`,`nz_mailing`,`active`,`warriors_mailing`,`bcc_mailing`,`level`) Values('','$username','$firstname','$lastname','$dob','$address','$city','$country','$phone','$email','$password','$nz_mailing','$active','$warriors_mailing','$bcc_mailing','$level')") or die("INSERT error: ".mysql_error());
}
?>
<p></p>
</font></font></td>
</tr>
</table>
</div>
<hr color="#000000" width="97%" size="1">
<p align="center"><?php
require("../includes/footer.php");
?></p>
</font></td>
<td width="150" align="right" valign="top"><?php
require("../includes/rightmenu.php");
?></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</body>
</html>
any ideas?