Hey guys,
I was wondering if it was possible to add a value to query_posts? I have a simple form on my website (www.bayofplenty.info) that has a select box to select the number of bedrooms a property has (which is a custom field) and I'm trying to add it to a results page query with the variable $bedrooms. The form is working fine because I can echo the results, but the query isn't picking it up.
The query code I'm using is:
<?php $bedrooms = $_POST['bedrooms']; ?>
<?php $key = '_ct_selectbox_4e4f46f4788f8' ?>
<?php query_posts('post_type=property&meta_key=$key&meta_value=$bedrooms&posts_per_page=10&orderby=ASC'); ?>
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<?php the_title(); ?>
<?php the_content(); ?>
<?php endwhile; ?>
<?php else: ?>
Sorry, no results were found for your search.
<?php endif; ?>