You can use the same technique for both, do a query of the database for the name or email address, and if you find a match, tell them otherwise, let them proceed.
Here's a stripped down example of what I use.
//get the POST data
$Email1 = addslashes($_POST['Email1']);
$Email2 = addslashes($_POST['Email2']);
$UserName = addslashes($_POST['UserName ']);
//check the email address
if (! ereg('[A-Za-z0-9_-]+\@[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+', $Email1))
{
die("<p> </p><p> </p><p align='center' style='margin-left:10px'><font face='Arial' size='3' color='#FF0000'>You did not enter a valid email address.<br>Please use the 'Back' button to correct this entry.</font></p><p align=center style='margin-left:10px'><a href='javascript:history.go(-1)'><img border=0 src=../images/back-button2.gif style='margin-top:10px'></a>");
}
//warn them if the email address's don't match (I am assuming you have them enter the email address 2 times for accuracy)
if ($Email1 != $Email2){
die("<p> </p><p> </p><p align='center' style='margin-left:10px'><font face='Arial' size='3' color='#FF0000'>Your email addresses do not match.<br>Please use the 'Back' button to correct this entry.</font></p><p align=center style='margin-left:10px'><a href='javascript:history.go(-1)'><img border=0 src=../images/back-button2.gif style='margin-top:10px'></a>");
}
//now query the database for the email address and warn them if it is already used (do the same for the username)
$query = 'SELECT * FROM your_database WHERE EmailAddress="'.$Email1.'"';
$result = mysql_query($query) or die(mysql_error());
$num_rows = mysql_num_rows($result);
if($num_rows<1){
$sql ="insert into your_database";
$sql .="(EmailAddress, FirstName, LastName, Password, UserName, Etc)";
$sql .="values('$EmailAddress', '$FirstName', '$LastName', '$Password', '$UserName', '$Etc')";
$var = "Thank you. Blah, blah, blah.";
if(!mysql_query($sql)){
echo mysql_errno().'<br>'.mysql_error().'<br><br>';
}
} else {
$var = "That email address is already registered. Blah, blah, blah";
}
//Then on your results page just echo $var (it will give you either the your OK $var or not OK $var from above).
If that does not make sense, please let me know and I will try to elaborate.
Don