I'm able to pass a variable in a url like so:
http://mysite.com/?searchterm=544
.. and I am able to GET the variable and display it in a php echo like so (this is placed before the loop):
<?php $searchterm = $_GET["searchterm"]; ?>
Search term: <?php echo $searchterm; ?>
BUT if I insert the echo in the query_post like so:
<?php query_posts('p=<?php echo $searchterm; ?>');
if ( have_posts() ) : while ( have_posts() ) : the_post();
?>
... it doesn't seem to work correctly, but if I manually enter 544 in place of the echo it works as expected.
Any ideas!? Thanks