ok i have this code on a page where you selest which to view but i would like it to start with view all then select if you see what i mean cheers Doug <div id="contents"> <p> <form name="search" method="post" action="<?=$PHP_SELF?>"> <Select NAME="county"> <option value="*">All</option> <Option VALUE="South West">South West</option> <Option VALUE="South East">South East</option> <Option VALUE="Wales">Wales</option> <option value="Scotland">Scotland</option> <option value="London">London</option> <option value="East England">East of England</option> <option value="West Midlands">West Midlands</option> <option value="East Midlands">East Midlands</option> <option value="Yorkshire">Yorkshire & Humberside</option> <option value="Northwest">North West</option> <option value="Northeast">North East</option> <option value="Other">Other</option> </Select> <input type="hidden" name="searching" value="yes" /> <input type="submit" name="search" value="Search" /> </form> PHP:
<?php // Connects to your Database $dbh=mysql_connect("localhost", "vcd", "57") or die('I cannot connect to database because: ' .mysql_error()) ; mysql_select_db("users"); //Retrieves data from MySQL $strcounty = mysql_real_escape_string($_POST['county']); if ($strcounty == "*") { $data = mysql_query("SELECT * FROM members WHERE region='HIRE' OR region='EXCHANGE/HIRE' or region='hire'") or die(mysql_error()); } else { $data = mysql_query("SELECT * FROM members WHERE (region='HIRE' OR region='EXCHANGE/HIRE' or region='hire') AND county='$strcounty'") or die(mysql_error()); } //Puts it into an array while($info = mysql_fetch_array( $data )) { //Outputs the image and other data Echo "<img src=http://www.djbcaravanhire.co.uk/images2/".$info['pname'] ." alt=\"Image\" align=\"left\" width=\"150px\" height=\"100px\" hspace=\"10px\" vspace=\"8px\"> <br>"; Echo "<b>Available for:</b><font color=blue> ".$info['region'] . "</font><br>"; Echo "<b>County:</b> ".$info['county'] . " <br>"; Echo "<b>Park Name:</b> ".$info['parkname'] . " <br>"; Echo "<b>Park Location:</b> ".$info['parklocation'] . " <br>"; Echo "<b>Make & Model:</b> ".$info['make'] . " <br>"; if(empty($info[web])) { $web = "Not Provided" ; } else { $web = "<a href=$info[web]>More Info</a> "; } echo '<b>Information: </b><a href="display.php?id='.$info['username'].'&slide='.$info['slide'].'">More Info</a><hr>'; } ?> PHP:
errr you are showing us you Database username and password remove it super quick..Change this -$dbh=mysql_connect("localhost", "**", "**") To this - $dbh=mysql_connect("localhost", "***REMOVE***", "***REMOVE***") note: just for showing here.