premora Posted May 4, 2011 Share Posted May 4, 2011 Hello all. I have an ID Messaging system where the user puts in the ID of the user they want to contact and it sends a message to their Inbox - Great. What I need is a feature where the user puts in the ID and onblur another textbox populates with the users Name from the MySQL Database without having to reload the page so they know they have the right person. I am pretty new to this so have no idea where to start with this population feature. Here's my form code. Hope someone can help. <table width="450" border="0"> <tr> <td> <form name="messages" method="post" action="inbox_messages_send.php" onsubmit="return checkform(this);"> <table width="411" height="227" border="0"> <tr> <td align="right" bgcolor="#EAEAEA"><font size="2" face="Arial, Helvetica, sans-serif">From:</font></td> <td bgcolor="#EAEAEA"><input type="hidden" name="sentBy" size="3" maxlength="3" align="absmiddle" value="<?php echo $_SESSION['member_ID']; ?>"> <input type="hidden" name="fname" value="<?php print email('name'); ?>"><input type="hidden" name="lname" value="<?php print email('lname'); ?>"> <font size="1" face="Arial, Helvetica, sans-serif">(Your ID is automatically attached)</font></td> </tr> <tr> <td align="right" bgcolor="#EAEAEA"><font size="2" face="Arial, Helvetica, sans-serif">To:</font></td> <td bgcolor="#EAEAEA"><input type="text" name="L_ID" size="3" maxlength="3" align="absmiddle"> <font size="1" face="Arial, Helvetica, sans-serif">(Member's ID)</font></td> </tr> <tr> <td align="right" bgcolor="#EAEAEA"><font size="2" face="Arial, Helvetica, sans-serif">Subject:</font></td> <td bgcolor="#EAEAEA"><input type="text" name="subject"></td> </tr> <tr> <td align="right" bgcolor="#EAEAEA"><font size="2" face="Arial, Helvetica, sans-serif">Message:</font></td> <td bgcolor="#EAEAEA"><textarea cols="35" rows="5" name="email_message"></textarea></td> </tr> <tr> <td align="right"> </td> <td><input type="submit" name="message" value="Send Message"></td> </tr> </table> </form></td> </tr> </table> Quote Link to comment https://forums.phpfreaks.com/topic/235508-onblur-to-mysql-dynamic-validation/ Share on other sites More sharing options...
vicodin Posted May 4, 2011 Share Posted May 4, 2011 Your gonna have to utilize AJAX for this... Google "AJAX and PHP Tutorial" Quote Link to comment https://forums.phpfreaks.com/topic/235508-onblur-to-mysql-dynamic-validation/#findComment-1210385 Share on other sites More sharing options...
premora Posted May 4, 2011 Author Share Posted May 4, 2011 Thanks. Any ideas if this is going to be completely complicated or a short bit of code to get the data? I've not used AJAX before so wondered if anyone knew as this may take a while otherwise. Quote Link to comment https://forums.phpfreaks.com/topic/235508-onblur-to-mysql-dynamic-validation/#findComment-1210387 Share on other sites More sharing options...
vicodin Posted May 4, 2011 Share Posted May 4, 2011 AJAX isnt easy... There are a bunch of frameworks for PHP and AJAX, if you cant grasp it quickly then look into using a framework. It will ease the learning curve a little. Quote Link to comment https://forums.phpfreaks.com/topic/235508-onblur-to-mysql-dynamic-validation/#findComment-1210389 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.