Best way to pull in an email address for use by a contact me block?
Permalink
I have a block. It's a contact form for the web site I am working on. It allows entry of comments of whatever from site visitors which comments are then email to the site owner.
The site owner email address is entered through an edit of the block. In other words one cannot edit the nice looking form other than to enter or change the email address the block uses.
That email address is stored in the block's table.
All well and good.
Now I must pull that email address out and put it into a $to variable used within the controller of the block to then sent the information entered to the site owner email address.
What is the easiest way to pull that email address out of the block table?
Are there API call way's to access block table data? Do the table fields all reside in memory automatically when a block's controller is executed?
Any suggestions as to how best to do this would be appreciated.
Thanks.
Carlos
The site owner email address is entered through an edit of the block. In other words one cannot edit the nice looking form other than to enter or change the email address the block uses.
That email address is stored in the block's table.
All well and good.
Now I must pull that email address out and put it into a $to variable used within the controller of the block to then sent the information entered to the site owner email address.
What is the easiest way to pull that email address out of the block table?
Are there API call way's to access block table data? Do the table fields all reside in memory automatically when a block's controller is executed?
Any suggestions as to how best to do this would be appreciated.
Thanks.
Carlos
Apparently when the block is viewed (which it would have to be in order to use it) the field containing the email address that can be edited (and which I saved in the block table) shows up in the controller.
So I simply changed the line setting the TO variable to...
I've tested this pretty thoroughly and it works well.
Problem solved! That's a refreshing change...I mean to solve something so easily.
Carlos