First of all, I work on Codeigniter (which isn't really relevant).
Here's the thing, got a search bar which dumps the output into handler.php. It looks like this:
Code:
<div>
<form class="searchform" action="handler" method="get" name="search">
<label for="Recipe Search" >Recipe Search: </label>
<input class="searchfield" type="text" name="query" value="<?php if(isset($data['query'])) {echo ($data['query']);} else {echo "Type your ingredients";} ?>" onfocus="if (this.value == 'Type your ingredients') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Type your ingredients';}" />
<input class="searchbutton" type="submit" value="Go" />
</form>
</div>
Then handler.php looks like this:
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class handler extends CI_Controller {
public function index()
{
$data['search'] = $this->input->get(NULL, TRUE);
$data['title'] = array ('Search');
if($data['search'] == 'Type your ingredients'){$this->load->view('home_view'); }
else $this->load->view('search_results_view', $data);
}
}
So the searchbar by default always is going to send 'Type your ingredients', unless you actually type something like... carrots, onions, etc...
that is placed as an array to $data['search'] with that function on codeigniter, and I want that when that array is 'Type your ingredients' it triggers the If.
Any help please? <(^.^)>!