Not working!
-
Hi,
I want to grab/access the radio button value from what the user selected.
For example, in my contact form [radio card “cake” “balloons” “flowers”].I want to store my values into the database, the text values are working fine, but not the radio buttons..
Below is the code where I want the selected radio value to be emailed to me, just to see if I am getting the correct value from the radio buttons. I have tried text values, it works, but not the radio buttons. I also want to make sure the radio button value is not empty using posted_data.
What is the issue ??
add_action( 'wpcf7_before_send_mail', 'CF7_pre_send' ); function CF7_pre_send($cf7) { $submission = WPCF7_Submission::get_instance(); if ( $submission ) { //make sure the form title is ask a question if($cf7->title == "Ask a question"){ $posted_data = $submission->get_posted_data(); $mail = $cf7->prop('mail'); //In my contact form [radio card "cake" "balloons" "flowers"] $radiovalue = $posted_data['card']; //added to the message $mail['body'] .= $radiovalue; $cf7->set_properties(array('mail' => $mail)); } } }
- The topic ‘Not working!’ is closed to new replies.