hi all

The below code checks whether user already exists or not and echo the message accordingly

I m having trouble displaying a cross icon image with message if user already exists.

otherwise i dont want to show any message or may be remove message holder.

If i use insert image then the error i get is "undefined."

otherwise message is displayed fine.

vineet

PHP Code:
<?
$count 
mysql_num_rows(mysql_query("SELECT * FROM usertable WHERE `username`='".$username."'")); 
        
header('Content-Type: text/xml'); 
        
header('Pragma: no-cache'); 
        echo 
'<?xml version="1.0" encoding="UTF-8"?>'
        echo 
'<result>'
        if(
$count 0) { 
            echo 
'Sorry! This username already exists.'/* this displays message fine */
            
            
echo '<img src="images/cross_small.gif" alt="" />Sorry! This Login-ID already exists.'
            
/* But if i use image then message is displayed as "undefined"*/
        
}else{ 
            echo 
'.';  
        } 
        echo 
'</result>'
        
?>

this is message display holder
Code:
<span id="userlogin_error"></span>

this is ajax script

Code:
if(handle.value.length > 0) { 
        var fullurl = url + 'do=check_username_exists&username=' + encodeURIComponent(handle.value); 
        http.open("GET", fullurl, true); 
        http.send(null); 
        http.onreadystatechange = statechange_username; 
    }else{ 
        document.getElementById('userlogin_error').innerHTML = ''; 
    } 
} 

function statechange_username() { 
    if (http.readyState == 4) { 
        var xmlObj = http.responseXML; 
        var html = xmlObj.getElementsByTagName('result').item(0).firstChild.data; 
		document.getElementById('userlogin_error').innerHTML = html; 
		
    } 
}