Home Forums Plugin Support WP User Frontend Pro Conditional statement for dropdown

This topic is: not resolved

This topic contains 4 replies, has 3 voices, and was last updated by  Sk 4 years, 8 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • #26305

    Post count: 6


    I have a dropdown in one of the forms called “what” , depending on the selection they do (I put them values 1, 2 , their names are looking for, proposing), I want things to appear, but even with a simple test echo to try, I don't success to make it work …
    Any help please ?

    	$what = get_post_meta( $post->ID, 'what');
    	if( $what == 1 ){  
    	echo ('LOOKING FOR');
    	}elseif ( $what == 2 ){
    	echo ('PROPOSING');	
    		} ?>

    Sekander Badsha
    Post count: 2067

    Hello Olivier,
    Your question is not clear to me. Can you please send me some screenshots?


    Post count: 6

    Hi Sekander, thanks for the answer,

    Basically here is the screenshot of the form, with the dropdown statement called “what” :

    I want to display different things on the article page created if the user has selected the option 1, 2, 3 or 4 (values of the dropdown), on the above code, its is just an example with the “echo”,

    But I don't succeed checking which value of the dropdown the user has selected when he created the post,

    Hope this is clear enough, let me know otherwise,

    Thanks in advance,



    Post count: 6

    Finally found the solution, I add it bellow in case it can help someone,
    It's working now with the following :

    < ?php $value = get_post_meta($post->ID, ‘what', true);

    if($value == ‘1') {
    echo ‘test 1';
    } else {
    echo ‘Nothing';





    Post count: 371

    Hello Olivier,

    Great work. you can do this by conditional logic. just create a text field or html field or any other you want after the dropdown field and use conditional logic on the field. check the image here


    Thank you

Viewing 5 posts - 1 through 5 (of 5 total)

The topic ‘Conditional statement for dropdown’ is closed to new replies.