Location: PHPKode > scripts > Phones Complete Script > example.php
<?php

//declaring class instance
include("./mobile.class.php");
$mob = new mobile_phones();


if(isset($_POST['search']))
{
	//excluding post search data from request url
	$ex[0] = 'search';
	
	//creating search url from array of parameters
	$url = $mob->make_url($_POST, $ex);
	//performing search based on created url
	$phones = $mob->search($url);
	//outputing result
	echo "<pre>";
	print_r($phones);
	echo "</pre>";
}
//selecting all phone related parameters
$arr = $mob->get_param_list("bluetooth");
//simple userinterface form
echo "<form action='' method='post'>";
echo "<table>";
foreach($arr as $key => $val)
{
	echo "<tr>";
	//create select input for bluetooth
	if($val == "bluetooth")
	{
		echo "<td>".$val."</td><td><select name='".$val."'>";
		echo "<option value=''></option>";
		//selecting all possible values for bluetooth parameter
		$btvals= $mob->get_all_values($val);
		//outputting values
		foreach($btvals as $bt)
		{
			echo "<option value='".$bt."'>".$bt."</option>";
		}
		echo "</select></td>";
	}
	//else creating simple text boxes
	else
	{
		echo "<td>".$val."</td><td><input type='text' name='".$val."' ";
		if(isset($_POST[$val]))
		{
			echo "value='".$_POST[$val]."'";
		}
		echo "/></td>";
	}
	echo "</tr>";
}
echo "<tr><td colspan='2' align='center'><input type='submit' value='Search'/></td></tr>";
echo "</table>";
echo "<input type='hidden' name='search'/>";
echo "</form>";
	
?>
Return current item: Phones Complete Script