Use wordpress search to display results within a post

WP_Query accepts a search parameter, ‘s’. Hence, you can just do this:

<?php $related_posts = new WP_Query( 's=" . the_title_attribute( "', '', 0 ) );

if( $related_posts->have_posts() ) : while( $related_posts->have_posts() ) : $related_posts->the_post();

    // STUFF

endwhile; endif; wp_reset_postdata(); ?>

While we’re here, note the use of WP_Query which is more appropriate for a secondary loop. You can also take a look at the link above if you want to add additional paramemters to restrict by post_type or taxonomy or anything else.