Problems, need help? Have a tip or advice? Post it here.
6 posts Page 1 of 1
Hi, I'd like to build a form (which will be send to other page) with some hide informations, hovewer, if I just use a "input type hidden", this information still accessible (and editable) via the HTML page source code.

So, I'd like to know if in Couch CMS there is a method to completely hide the information from the user, but still be able to send it using a form.

Thank you.
Hi,
if I just use a "input type hidden", this information still accessible (and editable) via the HTML page source code.
If it is only the 'editable' part that you are worried about, you can safely use cms:input type='hidden' because this field is immutable (always retains the value set originally in code).

Would that help?
Thanks, @KK. I would add also a solution with 'flash' or 'session'.

@carl99, some hidden information would be some user-related or product-related details. Let's say it's something you'd like to keep both hidden and non-editable. Please read about session variables. viewtopic.php?f=5&t=7377
This way you can pass info to the next page as never-printed variable, on that next page read this variable and do anything with this (store in editable field for that user, send email etc.). If you can share what this is about - would be cool.
Join COUCH:TALK channel here https://t.me/couchcms_chat
Ryazania — a framework to boost productivity with Add-ons viewtopic.php?f=2&t=13475
Support my efforts to help the community https://boosty.to/trendo/donate
I think the session variables will help me. Thank you!


But now I have another question, I'd like to manage some variables using php, here is a example:
Code: Select all
<cms:php>
      <cms:if "<cms:pp_count_items />" >
         <cms:pp_cart_items>
            echo('<cms:show title />');
         </cms:pp_cart_items>
      </cms:if>
</cms:php>


But, instead printing, I'd like to save the '<cms:show title />' into positions of an array. Is it possible?
I'd like to save the '<cms:show title />' into positions of an array. Is it possible?

Since you are already using PHP, following should do what you want -
Code: Select all
<cms:php>
    global $my_items;
    $my_items = array();
   
    <cms:if "<cms:pp_count_items />" >
        <cms:pp_cart_items>
            $my_items[] = '<cms:show title />';
        </cms:pp_cart_items>
    </cms:if>
</cms:php>

Please always remember to declare variables as 'global' if you wish to use them elsewhere.
For example, the following would echo back all the items -
Code: Select all
<cms:php>
    global $my_items;
   
    foreach( $my_items as $item ){
        echo $item . '</br>';
    }
</cms:php>

Hope it helps.
It really helped, thank you so much! ;)
6 posts Page 1 of 1
cron