BigDon Posted October 28, 2010 Share Posted October 28, 2010 Hi folks, I just found this group and joined up! I have encountered a problem that I am not sure how to resolve, and I hope someone can assist. I run this query against my MySQL database: mysql_select_db($database_commdb, $commdb); $query_rsEmailAddress = "SELECT admin_email FROM tbl_admins WHERE admin_id = 1"; $rsEmailAddress = mysql_query($query_rsEmailAddress, $commdb) or die(mysql_error()); $row_rsEmailAddress = mysql_fetch_assoc($rsEmailAddress); $totalRows_rsEmailAddress = mysql_num_rows($rsEmailAddress); ...and want to use the result to populate the "mail to" field for my response form. (I'm doing this to avoid having my email address posted in a page to be skimmed.) I presently use this: $to = rsEmailAddress['admin_email']; I do some empty fields checking before submitting the form. However, when I click on submit, my form, tells me I have empty fields and will not process when there are NO empty fields. HOWEVER, if I hard-code my email address in the variable "$to" all is well, the form processes correctly, I get the email, etc... So I suspect the problem lies somewhere in the way I have constructed the $to variable. I have scratched my head till I am going bald(er) and my scalp is bleeding!!! HELP!! Please!! :'( Link to comment https://forums.phpfreaks.com/topic/217125-sending-an-email-with-address-from-mysql-database/ Share on other sites More sharing options...
Pikachu2000 Posted October 28, 2010 Share Posted October 28, 2010 $to = rsEmailAddress['admin_email']; should be: $to = $row_rsEmailAddress['admin_email']; If that doesn't take care of it, please post your code for the script. Link to comment https://forums.phpfreaks.com/topic/217125-sending-an-email-with-address-from-mysql-database/#findComment-1127657 Share on other sites More sharing options...
BigDon Posted October 28, 2010 Author Share Posted October 28, 2010 DUDE! You're a genius! It works like it is supposed to. I had looked and looked and looked at the code and kept missing the really obvious... Guess I looked at it too much, huh??? Thanks for the help and the really quick response. Link to comment https://forums.phpfreaks.com/topic/217125-sending-an-email-with-address-from-mysql-database/#findComment-1127665 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.