POGRAN Posted November 4, 2006 Share Posted November 4, 2006 Hi there, guys!I have a search page on my web site that gets the information about user by his username from MySQL database.It has two input fields: username and full nameA visitor is typing in the username field his username, clicks on "Get Name" link and in the second field he sees his name.I know that it is possible to realize it in Ajax. I wrote already some code, you can see it's source here:[url=http://www.pogran.nm.ru/xajax.txt]http://www.pogran.nm.ru/xajax.txt[/url](it uses xAjax class)The only problem is that it doesn't get the full name correctly, it gets the fullname of user whose username = "". That means that the function check() doesn't see the $username (field's data)What is wrong with the script can you help me please guys!?Thanks in advance! Link to comment https://forums.phpfreaks.com/topic/26181-help-trouble-with-ajax-function/ Share on other sites More sharing options...
alpine Posted November 5, 2006 Share Posted November 5, 2006 function check([color=red]$asd[/color]) ?Try:[code]function check($username) { $result = "SELECT * FROM users WHERE username='$username'"; $result_sql = mysql_query ($result); $myrow = mysql_fetch_array($result_sql); $name = $myrow["name"]; $objResponse = new xajaxResponse(); $objResponse->addAssign('full_name', 'value', $name); return $objResponse->getXML();; }[/code] Link to comment https://forums.phpfreaks.com/topic/26181-help-trouble-with-ajax-function/#findComment-119863 Share on other sites More sharing options...
POGRAN Posted November 6, 2006 Author Share Posted November 6, 2006 No! It doesn't work..Please help!!! Link to comment https://forums.phpfreaks.com/topic/26181-help-trouble-with-ajax-function/#findComment-120263 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.