sorry about the nasty code, im just new to php and in the learning.
this is simply ament to add the inputs to a database. I know more validation needs done, but this is me learning, ill add more later
the page is displaying the form, however not presenting me with any echo messages before or after i click the submit button. must be something wrong in the code somewhere, but i cant find or work out exactly what it is. It could possibly be a problem with my { }'s, as I get confuzing after a while
can anyone see anything wrong? please dont say it all, it has took me all night to work out thus far. hehe
thanks again - mofish
this is simply ament to add the inputs to a database. I know more validation needs done, but this is me learning, ill add more later

the page is displaying the form, however not presenting me with any echo messages before or after i click the submit button. must be something wrong in the code somewhere, but i cant find or work out exactly what it is. It could possibly be a problem with my { }'s, as I get confuzing after a while

can anyone see anything wrong? please dont say it all, it has took me all night to work out thus far. hehe
thanks again - mofish

Code:
<?
//grrrrrrrr work!
if (isset($_GET['register'])){
$name = $_POST['name'];
$password = $_POST['password'];
$location = $_POST['location'];
$email = $_POST['email'];
$query = "insert into `user_details` (`name`, `password`, `location`, `email`) values ('$name', '$password', '$location', '$email')";
if (trim($name) == ''){
echo 'you must input a username';
}
elseif (trim($password) == '') {
echo 'you must input a password';
}
elseif (trim($location) == '') {
echo 'you must input a location';
}
elseif (trim($email) == '') {
echo 'you must input a email';
if (mysql_query($query)){
echo 'added to database succesfully';
} else {
echo 'error adding to database';
}
} else {
echo 'they are not valid';
}
}
else
{
?>
<form action="index.php" method="post">
<table width="260" style="border: 1px dotted; background-color:#FFFFCC">
<tr>
<td width="106">Nick Name</td>
<td width="144"><input type="text" name="name"></td>
</tr>
<tr>
<td width="106">Password</td>
<td width="144"><input type="password" name="password"></td>
</tr>
<tr>
<td width="106">Location</td>
<td width="144"><select name="location" style="width:144px">
<option>United Kingdom</option>
<option>USA</option>
</select>
</td>
</tr>
<tr>
<td width="106">Email</td>
<td width="144"><input type="text" name="email"></td>
</tr>
<tr>
<td colspan="2"><input name="submit" type="submit"></td>
</tr>
</table>
</form>
<?
}
?>