I'm trying to use the following code that is in the resource section. I'm linking it to an html button I already have in use, that creates a new post.
When I use this code it does create an entry but it continuously creates one non-stop. I've tried using it twice and the last time it crashed my server because of the intense CPU spike. It creates an entry roughly every second. I've been using it with the Code Snippets plugin. What am I doing wrong? I only want one entry to be created when my action (button click) is triggered.
<?php global $user_ID; FrmEntry::create(array( 'form_id' => 5, //change 5 to your form id 'item_key' => 'entry', //change entry to a dynamic value if you would like 'frm_user_id' => $user_ID, //change $user_ID to the id of the user of your choice (optional) 'item_meta' => array( 25 => 'value', //change 25 to your field ID and 'value' to your value 26 => 'value', 27 => 'value', //add any field ids here with the value to insert into it ), )); ?>