Hi everyone, I have a problem that seems simple but I can't solve it.
When I submit my form, a php script starts that sends data via API, the script works and starts for the indicated form.
Now in my php script I have to intercept the values of some fields of my form and print them in a precise point of my php script.
This is the script now and it works with plain text:
$smsSent = sendSMS($auth, array(
"message" => '$email' ,
"message_type" => MESSAGE_LOW_QUALITY,
"returnCredits" => false,
"recipient" => array("+393456840678"),
"sender" => null, // Place here a custom sender if desired
)); if ($smsSent->result == "OK") {
echo 'SMS sent!';
}
}}
Now I need to intercept the fields in my form and print
"message" => MY FORMIDABLE FIELD VALUE
"recipient" => MY FORMIDABLE FIELD VALUE Thanks to anyone who can help me
Please login or Register to submit your answer
How are you executing the script? Which Formidable Hook are you using?
Hello and thanks for your reply.
the hook I use is
add_action('frm_after_create_entry', 'yourfunctionname', 30, 2);
function yourfunctionname($entry_id, $form_id){
if($form_id == 78){
and it works perfectly, my code is executed after the creation of my entry and only on form 78.
The code that sends data via API generates an SMS and this works fine too.
The problem is to recover the data present in the form and pass it via API to the SMS sending system.
I tried with the $_POST method and immediately after echo but it doesn't work.
This is where you should enter the value of my fields:
if (isset($_POST['submit'])) {
$your_name = $_POST [item_meta[1350]];
}
$smsSent = sendSMS($auth, array(
"message" => my formidable form value
"message_type" => MESSAGE_LOW_QUALITY,
"returnCredits" => false,
"recipient" => array(my formidable form value),
"sender" => null, // Place here a custom sender if desired
/** "scheduled_delivery_time" => date('YmdHi', strtotime("+1 minutes")), // postpone by 1 minutes */
));
if ($smsSent->result == "OK") {
echo 'SMS sent!';
}
}}
The information you need is accessed using the $entry_id parameter: $entry = FrmEntry::getOne($entry_id, true);
You’re using $_POST incorrectly. Your call to the variable should be $_POST['item_meta'][1350]. In your code you are nesting the brackets.
Thanks, you were fantastic, the problem was just how I wrote the formidable field, I had never seen fields enclosed in multiple brackets, now everything works.
THANK YOU.
$_POST is not a Formidable field. $_POST is a PHP associative array. That's why the multiple brackets. An associative array in PHP represents an ordered map. A map is a data form that associates keys with values.