cleanvar()
Account Closed
- Impact
- 0
Hi,
The script below, the search doesnt give the results that i know are in the table but my main problem language or lang isnt being inserted to the db properly.
Will
The script below, the search doesnt give the results that i know are in the table but my main problem language or lang isnt being inserted to the db properly.
Will
PHP:
<?php
include('connect.php');
if (isset($_POST['submit']))
{
$hostt = $_POST['hostt'];
$hc = $_POST['hc'];
$lang = $_POST['language'];
$mds = $_POST['mds'];
$mbw = $_POST['mbw'];
$sl = $_POST['sl'];
$ads = $_POST['ads'];
echo "You chose: <b>Type:</b> $hostt, <b>Langauge: $lang, </b><b>Cost:</b> $hc, <b>Min Diskspace:</b> $mds, <b>Min B/W:</b> $mbw, <b>Server Location:</b> $sl, <b>Ads:</b> $ads.";
$query = "SELECT * FROM hosts WHERE type = '$hostt' AND cost = '$hc' AND language = '$lang' AND mindisk <= '$mds' AND minbw <= '$minbw' AND serverlocation = '$sl' AND ads = '$ads'";
$result = mysql_query($query) or die (mysql_error());
$cr = mysql_num_rows($result);
if ($cr == 0)
{
echo "<br><br>No results found, Sorry.<br><br><br>";
}
while ( $row = mysql_fetch_array($result));
{
$name = $row['name'];
$url = $row['url'];
$type = $row['type'];
$cost = $row['cost'];
$language = $row['language'];
$mindisk = $row['mindisk'];
$minbw = $row['minbw'];
$serverlocation = $row['serverlocation'];
$ads = $row['ads'];
// Now echo results
if ($cr == 1)
{
echo "Company matches which meet your criteria";
echo "<a href=\"$url\"><b>$name</b></a><br>
<b>Type:</b>$type<br>
<b>Cost:</b>$cost<br>
<b>Language:</b> $language<br>
<b>Minimum Disk Space:</b> $mindisk<br>
<b>Minimum Bandwith:</b> $minbw<br>
<b>Server Location:</b> $serverlocation<br>
<b>Ads:</b> $ads<br><br>
";
}
}
//end else
}
?>
<form name="search" method="post">
Type of Host: <select name="hostt">
<option>Shared</option>
<option>Reseller</option>
<option>Shoutcast</option>
<option>Dedicated</option>
<option>VPS</option>
<option>File</option>
<option>Image</option>
<option>Video</option>s
<option>Game</option>
<option>Other</option>
</select>
Hosting Cost: <select name="hc"><option>Free</option> <option>Paid</option> <option>Paid to Post</option> <option>Ads</option></select>
Language: <select name="language"><option>English</option> <option>Chineese</option> <option>German</option> <option>French</option> <option>Other</option></select>
Minimum Diskspace: <select name="mds"><option>0mb</option><option>50mb</option> <option>100mb</option> <option>500mb</option> <option>1000mb</option></select><br>
Minimum Bandwith: <select name="mbw"><option>0gb</option><option>1gb</option> <option>5gb</option> <option>10gb</option> <option>20gb</option></select>
Server Location: <select name="sl"><option>All</option> <option>UK</option> <option>USA</option> <option>Germany</option, <option>Other</option></select>
Ads: <select name="ads"><option>No</option><option>Yes</option></select>
<br><input type="submit" name="submit" value="Search"><input type="reset">
</form>
Last edited:








