• Hello,

    first of all, thank you for creating a plugin like Contact Form 7 and making it for free. It’s really useful and easy to use!

    But now I have a problem. The thing is that I have a page with plan prices. Each plan has a submit button (inside a form) so I can get the value I want through $_POST. The action of this simple form is redirected to one of the Contact Form 7 forms I prepared. Using the plugin “Allow PHP in posts” I could show the $_POST value, and see everything was working.

    After that I wanted to edit the select.php file, so I could match the value I wanted to select with the one from $_POST, so I made a conditional looking if the value from $_POST was empty, so it will show the normal form or not. But after that, I realised I couldn’t match the value that I wanted to be selected with the value from $_POST. And right here is my problem.

    I hope you could help me, so I’ve been looking for this problem for a few days.

    if ( empty($_POST["pla"]) ){
    		   $html .= sprintf( '<option %1$s>%2$s</option>',
    			   $item_atts, esc_html( $label ) );
            }else{
               $html .= sprintf('<option ');
    
               if ( ($_POST["pla"]) == '?what do I put here?') {
                   $html .= sprintf (' selected ');
               }
    
               $html .= sprintf( '%1$s>%2$s</option>',
    			   $item_atts, esc_html( $label ) );
            }

    http://wordpress.org/plugins/contact-form-7/

  • The topic ‘Option selected when $_POST==value’ is closed to new replies.