Muddy_Funster Posted April 22, 2012 Share Posted April 22, 2012 nope, it's in place of the of the html, so: <td><p class="LOC">Location:</p></td> <td><div id="LC"> <?php $locationSql = "SELECT id, area_name FROM Locations GROUP by area_name"; $locQry = mysql_query($locationSql) or die (mysql_error()); echo "<select name=\"areas\" multiple=\"multiple\" size\"=5\" style=\"width:150px;\">"; while ($location = mysql_fetch_assoc($locQry)){ echo "<option value=\"{$location['id']}\">{$location['area_name']}</option>"; } echo "</select>"; ?> </div> Quote Link to comment https://forums.phpfreaks.com/topic/261048-php-search-form/page/3/#findComment-1339608 Share on other sites More sharing options...
usman07 Posted April 23, 2012 Author Share Posted April 23, 2012 thanks mate, when I do this it cuts of the bottom of my page, and all my other fields disappear. Â You can check the link here: http://www.mumtazproperties.hostei.com/ Â Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/261048-php-search-form/page/3/#findComment-1339789 Share on other sites More sharing options...
Muddy_Funster Posted April 23, 2012 Share Posted April 23, 2012 take the capital off Locations, so it's all lower case: SELECT id, area_name FROM locations GROUP by area_name Quote Link to comment https://forums.phpfreaks.com/topic/261048-php-search-form/page/3/#findComment-1339791 Share on other sites More sharing options...
usman07 Posted April 23, 2012 Author Share Posted April 23, 2012 oh, that amazing! do I need to do the same for all the other fields? replacing the HTML code with the PHP? and would the PHP code be any different? would I just change where it says 'location'. Â Thanks so much for your continuous help. Quote Link to comment https://forums.phpfreaks.com/topic/261048-php-search-form/page/3/#findComment-1339792 Share on other sites More sharing options...
Muddy_Funster Posted April 23, 2012 Share Posted April 23, 2012 not much benefit to replacing the rest of the form items. That should do it for the index page. So onto the search results page: form is still using action="insert.php" and method="get". change the method to method="POST" and then put the following at the top of insert.php <?php die(vardump($_POST)); //...rest of your code  post up what you get back and we'll go through it. Quote Link to comment https://forums.phpfreaks.com/topic/261048-php-search-form/page/3/#findComment-1339794 Share on other sites More sharing options...
usman07 Posted April 23, 2012 Author Share Posted April 23, 2012 Iv done what u said and I get this error Fatal error: Call to undefined function vardump() in /home/a2221438/public_html/insert.php on line 28  I must of done something wrong.  Do i place this code at the top of the page or just before my php code?and is there not meant to be a closing php tag. <?php die(vardump($_POST)); //...rest of your code  This is some of my insert.php file <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Mumtaz Properties</title> <link rel="stylesheet" href="cutouts/style.css"/> </head> <body> <!--Main Div Tag--> <div id="wrapper"> <div id="header"> <div id="logo"><a href="index.html"><img src="cutouts/Homepage/logo.png" alt=""/></a></div> </div> <div id="navigation"> <a id="Home" href="index.php" title="home"><span>home</span></a> <a id="Sale" href="forsale.html" title="for sale"><span>for sale</span></a> <a id="Rent" href="forrent.html" title="for rent"><span>for rent</span></a> <a id="Contact" href="contact.html" title="contact us"><span>contact us</span></a> </div> <div id="main"> <div id="results"><img src="cutouts/Homepage/results.png"></div> <?php if ($debug) { // a variable I set at script top for debugging ;-)  echo "<!-- $sql -->"; } ..............................CONTINUED Quote Link to comment https://forums.phpfreaks.com/topic/261048-php-search-form/page/3/#findComment-1339797 Share on other sites More sharing options...
Muddy_Funster Posted April 23, 2012 Share Posted April 23, 2012 it was me again, it's var_dump() not vardump() Quote Link to comment https://forums.phpfreaks.com/topic/261048-php-search-form/page/3/#findComment-1339803 Share on other sites More sharing options...
usman07 Posted April 23, 2012 Author Share Posted April 23, 2012 Ahhh ok, I get this: array(6) { ["areas"]=> string(1) "1" ["property_type"]=> string(4) "none" ["min_bedrooms"]=> string(1) "0" ["max_bedrooms"]=> string(1) "0" ["min_price"]=> string(1) "0" ["max_price"]=> string(1) "0" } Quote Link to comment https://forums.phpfreaks.com/topic/261048-php-search-form/page/3/#findComment-1339805 Share on other sites More sharing options...
usman07 Posted April 23, 2012 Author Share Posted April 23, 2012 Just another thing, I realised the drop down list brings up prices like £50,£60,£70 etc..how would i change it to £50,000 etc <select name="min price"> <?php $priceLimit = 350; for($minPrice = 40; $minPrice <= $priceLimit; $minPrice =( $minPrice+ 10)){  if ($minPrice == 40){   echo"<option value=\"0\" selected=\"selected\">No Min</option>";  }  else{   echo "<option value\"$minPrice\">£$minPrice</option>";  } } ?> </select> to <select name="max price"> <?php $priceLimit = 350; for($maxPrice = 40; $maxPrice <= $priceLimit; $maxPrice =( $maxPrice+ 10)){  if ($maxPrice == 40){   echo"<option value=\"0\" selected=\"selected\">No Max</option>";  }  else{   echo "<option value\"$maxPrice\">£$maxPrice</option>";  } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/261048-php-search-form/page/3/#findComment-1339808 Share on other sites More sharing options...
Muddy_Funster Posted April 23, 2012 Share Posted April 23, 2012 for the price thing, either just add the relevent no of 0's into the if condition, or, my preffered way would be to add them onto the string: echo "<option value\"$minPrice\,000">£$minPrice,000</option>"; (makes it easier to get the , in there)  I'm guessing from the var_dump that you didn't change over the Property Type so it was the same as the areas element? Quote Link to comment https://forums.phpfreaks.com/topic/261048-php-search-form/page/3/#findComment-1339812 Share on other sites More sharing options...
usman07 Posted April 23, 2012 Author Share Posted April 23, 2012 oh right am i suppose to change the property type to php coding as well? just like i did with 'location' would the php code be the same? Quote Link to comment https://forums.phpfreaks.com/topic/261048-php-search-form/page/3/#findComment-1339814 Share on other sites More sharing options...
Muddy_Funster Posted April 23, 2012 Share Posted April 23, 2012 you would need to cahnge the query slightly, , and the <select> into that the php outputs, but yeah, the rest would efectivly be the same. Quote Link to comment https://forums.phpfreaks.com/topic/261048-php-search-form/page/3/#findComment-1339815 Share on other sites More sharing options...
usman07 Posted April 23, 2012 Author Share Posted April 23, 2012 For the pricing its not working and Im getting an error  This is what iv done:  echo "<option value\"$minPrice\,000">£$minPrice,000</option>";  This is the error: Parse error: syntax error, unexpected '&' in /home/a2221438/public_html/index.php on line 160 Quote Link to comment https://forums.phpfreaks.com/topic/261048-php-search-form/page/3/#findComment-1339816 Share on other sites More sharing options...
Muddy_Funster Posted April 23, 2012 Share Posted April 23, 2012 "<option value\"$minPrice000\">£$minPrice,000</option>"; will fix that, also I have taken the ' out of the value = (having thought about it some this will be for the best) Quote Link to comment https://forums.phpfreaks.com/topic/261048-php-search-form/page/3/#findComment-1339821 Share on other sites More sharing options...
usman07 Posted April 23, 2012 Author Share Posted April 23, 2012 Thanks mate that works now. is there some way to adjust the width because the drop down's are a little out of my search box, Â you can see it here: http://www.mumtazproperties.hostei.com/index.php Quote Link to comment https://forums.phpfreaks.com/topic/261048-php-search-form/page/3/#findComment-1339823 Share on other sites More sharing options...
Muddy_Funster Posted April 23, 2012 Share Posted April 23, 2012 you can add style='width:**px;' to the submit tag to set the width, I think you are already doing it on the areas select... Â Let's see what you coded for the property_type select Quote Link to comment https://forums.phpfreaks.com/topic/261048-php-search-form/page/3/#findComment-1339830 Share on other sites More sharing options...
usman07 Posted April 23, 2012 Author Share Posted April 23, 2012 Could the width be set like this? <select name="min price" width="80px"> <?php $priceLimit = 350; for($minPrice = 40; $minPrice <= $priceLimit; $minPrice =( $minPrice+ 10)){  if ($minPrice == 40){   echo"<option value=\"0\" selected=\"selected\">No Min</option>";  }  else{   echo "<option value\"$minPrice000\">£$minPrice,000</option>";  } Quote Link to comment https://forums.phpfreaks.com/topic/261048-php-search-form/page/3/#findComment-1339831 Share on other sites More sharing options...
Muddy_Funster Posted April 23, 2012 Share Posted April 23, 2012 try it and see Quote Link to comment https://forums.phpfreaks.com/topic/261048-php-search-form/page/3/#findComment-1339832 Share on other sites More sharing options...
usman07 Posted April 23, 2012 Author Share Posted April 23, 2012 thanks I got it this worked <select name="min price" style='width:80px;'> Quote Link to comment https://forums.phpfreaks.com/topic/261048-php-search-form/page/3/#findComment-1339833 Share on other sites More sharing options...
Muddy_Funster Posted April 23, 2012 Share Posted April 23, 2012 it words on any tag, I thought that it was the submit button that was falling off. use it on a select, a table, a div, pretty much anything : <select name="name" style="width:80px;"> || <input type="submit" name="submit" value="Click Me" style="width:80px;" /> || <table border="1" style="width:80px;"> || <ul style="width:80px;">  you get the idea Quote Link to comment https://forums.phpfreaks.com/topic/261048-php-search-form/page/3/#findComment-1339839 Share on other sites More sharing options...
usman07 Posted April 23, 2012 Author Share Posted April 23, 2012 Yeah,thanks for that here is what i'v done for the php code for property_type. i think I have messed it all up tho. <div id="ptype"> <?php $propertySql = "SELECT id, area_name FROM property GROUP by type"; $proQry = mysql_query($propertySql) or die (mysql_error()); echo "<select name=\"radio\" multiple=\"multiple\" size\"=5\" style=\"width:150px;\">"; while ($property = mysql_fetch_assoc($proQry)){ echo "<option value=\"{$property['id']}\">{$property['type']}</option>"; } echo "</select>"; ?> </div> Â Quote Link to comment https://forums.phpfreaks.com/topic/261048-php-search-form/page/3/#findComment-1339842 Share on other sites More sharing options...
Muddy_Funster Posted April 23, 2012 Share Posted April 23, 2012 ahh, your using a table....try changing "Number of Bedrooms" to "No. of Bedrooms". Â I'm off for today, research $_POST and have a look on my blog - ( http://muddy-dev.blogspot.co.uk/ ) there is a section on there that covers simple SQL using JOINS, your going to need to know that for the results page. Quote Link to comment https://forums.phpfreaks.com/topic/261048-php-search-form/page/3/#findComment-1339844 Share on other sites More sharing options...
usman07 Posted April 23, 2012 Author Share Posted April 23, 2012 Ok mate, thank so very much for your help! Â just 1 thing u mention about changing to No. of bedrooms? where do i do that? Quote Link to comment https://forums.phpfreaks.com/topic/261048-php-search-form/page/3/#findComment-1339847 Share on other sites More sharing options...
Muddy_Funster Posted April 23, 2012 Share Posted April 23, 2012 <div id="table2"> <table id="NBtable"> <tbody><tr> <td><p class="NBS">Number of bedrooms:</p></td>Â Â <<<<<<<--------here <td><div id="NB"> Quote Link to comment https://forums.phpfreaks.com/topic/261048-php-search-form/page/3/#findComment-1339848 Share on other sites More sharing options...
Muddy_Funster Posted April 23, 2012 Share Posted April 23, 2012 you also need to add an = sign to the last echo in this bit of code (compare with your last post of this code), and check the maxPrice one aswell <select name="min price" width="80px"> <?php $priceLimit = 350; for($minPrice = 40; $minPrice <= $priceLimit; $minPrice =( $minPrice+ 10)){  if ($minPrice == 40){   echo"<option value=\"0\" selected=\"selected\">No Min</option>";  }  else{   echo "<option value=\"$minPrice000\">£$minPrice,000</option>";  } Quote Link to comment https://forums.phpfreaks.com/topic/261048-php-search-form/page/3/#findComment-1339849 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.