i want to display a default value like 'select category' insted of blanck space
here is my tables
category_tbls
id
cat_name
subcategory_tbls
id
category_tbls_id
sub_cat
Model Addcat.php
class Addcat extends AppModel
{
public $name = 'category_tbls';
public $hashMany = 'subcategory_tbls';
}
Model Subcat.php
class Subcat extends AppModel
{
public $name = 'subcategory_tbls';
public $belongsTo = 'category_tbls';
}
AdminController.php
public function subcat()
{
$this->loadModel("Subcat");
if($this->Subcat->save($this->request->data))
{
$this->Session->setFlash('Successully save your information!');
}
$this->loadModel("Addcat");
$dt=$this->Addcat->find('list',array('fields'=>array('id','cat_name')));
$this->set('drop',$dt);
view file is as bellow
subcat.ctp
<h2>Add Sub Category!</h2>
<form action="subcat" method="post">
<?php echo $this->Form->select('category_tbls_id',$drop);?>
<input type="text" name="sub_cat" placeholder="sub category name" required/>
<button type="submit" class="b1">Add Sub Category</button>
</form>