• Hi Folks,

    I have searched the forum, but can’t seem to find an answer to this.
    I have the following select in my form:

    <label>Class *[select* class id:class first_as_label "-- Select class --" "Dublin (04 Nov 2019, 19:00)|5" "London (19 Jan 2020, 18:30)|0" "London (19 Jan 2020, 20:00)|0" "Manchester (10 Feb 2020, 19:00)|5"]</label>

    I can access [class] and [_raw_class] in the email template, but how do i access this [_raw_class] on the server side via PHP?

    <?php
    
    //Contact Form 7 Custom Output
    add_filter('wpcf7_posted_data', function($data) {
      	$form = wpcf7_get_current_contact_form();
    	
      	if($form->id() == 11398) {
    		//Class
    		$class = $data['_raw_class'];
    		
    		//City
    		$city = substr($class, 0, -21);
    		
    		//Address
    		switch($city) {
        			case "Dublin":
            				$data['address'] = "Xxx";
            				break;
        			case "London":
            				$data['address'] = "Yyy";
            				break;
        			case "Manchester":
            				$data['address'] = "Zzz";
            				break;
    			default:
    				$data['address'] = "";	
    		}
    	}
    	return $data;
    }
    );
    
    ?>

    I have tried the following, but to no avail:

    $class = $data['_raw_class'];
    $class = $data['_raw_{class}'];
    $class = $data['{_raw_class}'];
    $class = $data['[_raw_class]'];
    $class = $data['_raw_[class]'];

    Any help on this will be greatly appreciated.
    Thanks Folks,
    Regards,
    Conor

    • This topic was modified 4 years, 10 months ago by Conor_Hyland.
  • The topic ‘Parse “_raw_class” Via PHP Server Side’ is closed to new replies.