Hi everyone, this is probably something really dumb that I am missing, 
but I need help.  This code upon submit calls this error trapping 
function (to test for duplicate usernames).  There is a hidden field 
named "step" that has a value of "1".
It is working on another page but I am trying to use this code and 
apparently leaving something out?  

Thanks for any help.  


$step = isset($_POST['step']) ? $_POST['step'] : 0;
$username = isset($_POST['username']) ? $_POST['username'] : '';
$error = '';

switch ($step)  
        {
        case 0; // do nothing, drop through and get user data
        break;
        
        case 1: // the user has submitted data, now check it.

//if ($error =='')
        //      {                                       
                $query = "SELECT * FROM Providers WHERE 
username='$username' ";
                echo $query; 
                $result = mysql_query($query) or die(mysql_error());    
        
                $myrow = mysql_fetch_assoc($result);
                
                if (!empty($myrow))
                        {
                        $error =  "Sorry, this username is already 
taken";
                        }
        //      }
//break;
}


-- Kristina 
_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk

NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com

Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php

Reply via email to