Forum for discussing general topics related to Couch.
5 posts Page 1 of 1
I am trying to build a form where the IP address of the user is sent as part of a hidden field. I can do it with $_SERVER['REMOTE_ADDR'] but i want to keep all my code in couch. Is there an equivalent?

In addition, I would like to know if i can send 2 different emails in k_success instance:

Code: Select all
<cms:if k_success >

MESSAGE TO WEBSITE OWNER
=======================
<cms:send_mail from=frm_email to='sales@website.com' subject='Quotation Request'>
Quotation Request
=============
<cms:show k_success />
</cms:send_mail>

MESSAGE TO CUSTOMER
=======================
<cms:send_mail from=sales@website.com to=frm_email subject='Thank you for your quotation Request'>
Message to CUSTOMER
</cms:send_mail>

</cms:if>
Hi Jeph,

We can send multiple emails in the same success block so the snippet you posted should ideally work. Is it not working for you?

Also, there is no Couch variable for $_SERVER['REMOTE_ADDR'] but you can simply use the following within any Couch code -
Code: Select all
<cms:php>echo( $_SERVER['REMOTE_ADDR'] );</cms:php>

Does it help?
Thank you very much KK. That was very helpful.
I think I would use this often if it had been available as avariable k_user_ip or similar. :)
Couch already logs the IP address for the creation of each new page even with Databound forms. If you look at couch_pages there is a header called `creation_ip`. It would be very easy to access this as k_creation_ip or k_user_ip by editing the core couch files
5 posts Page 1 of 1