<?php
class Page extends SiteTree {
static $db = array(
);
public static $has_one = array(
);
public static $has_many = array(
);
public function getCMSFields() {
$fields = parent::getCMSFields();
return $fields;
}
}
class Page_Controller extends ContentController {
//Define our form function as allowed
static $allowed_actions = array(
'Searchform'
);
//The function which generates our form
function Searchform()
{
// Create fields
$fields = new FieldSet(
new DropdownField('search_user','',
array ('used' => 'used product', 'new' => 'new product')),
new TextField('search_product', '')
);
// Create action
$actions = new FieldSet(
new FormAction('results', 'Send')
);
// Create action
$validator = new RequiredFields('search_user', 'search_product');
return new Form($this, 'Searchform', $fields, $actions, $validator);
}
function results($data, $form)
{
//Set data
echo $From = $data['search_user'];
echo $From1 = $data['search_product'];
$sql_search ="select * from productuseditem where ProductNameUsed LIKE '%".$From1."%'";
$sql_search1=mysql_query($sql_search);
$result = mysql_num_rows($sql_search1);
$data = mysql_fetch_array($sql_search1);
print_r($data);
return $this->customise($data)->renderWith(array('Page_results', 'Page'));
}
}
?>
the fetched data will be on $data in results function but i cant understand that how we display that data on page_results.ss page.
for this line /* return $this->customise($data)->renderWith(array('Page_results', 'Page')); */
it will redirect into page_results.ss page but how we display that data.. please help me i ma new in silver strip..