this my code
function form_creation(){ ?>
<select name="page_id" id="page_id">
<?php
global $post;
$args = array('cat'=>19);
$posts = get_posts($args);
foreach( $posts as $post ) : setup_postdata($post); ?>
<option value="<? echo $post->ID; ?>"><?php the_title(); ?></option>
</select>
<?php
$my_postid = $post->ID;
$content_post = get_post( $my_postid);
$content = $content_post->post_content;
$content = apply_filters('the_content', $content);
$content = str_replace(']]>', ']]>', $content);
echo $content;
?>
<?php } add_shortcode('r', 'form_creation');
I want to display post content when I choose its title from the dropdown menu
but actually, it always displays the first one if I click on any title
I don't know why
can you help me, please?