Is it possible to assign two names to the CHtml::textField() method?

I have a PHP script which is using Yii framework 1.1.

In this script, there are two separate forms which are using for searching.

Restaurant search form:

    echo CHtml::textField('restaurant-search', '', array(
        'placeholder' => t("Search a restaurant"),
        'required' => true,
        'class' => "search-field search_restaurant_search"
    ))

Food search form:

    echo CHtml::textField('foodsearch', '', array(
        'placeholder' => t("Search food"),
        'required' => true,
        'class' => "search-field foodsearch"
    ))

I want to combine them into a single form. Is it possible with the textField method or do I have to use a different method?

you can have multiple form fields in one form make sure both of your textField are inside the form tags like so

<form action="" method="">
<?php
 echo CHtml::textField('restaurant-search', '', array(
        'placeholder' => t("Search a restaurant"),
        'required' => true,
        'class' => "search-field search_restaurant_search"
    ))

echo CHtml::textField('foodsearch', '', array(
        'placeholder' => t("Search food"),
        'required' => true,
        'class' => "search-field foodsearch"
    ))
?>
</form>

Thanks, but I have already tried this way. It prints two separate search box and this isn’t what I want exactly.

I want to have just one search box in which I can both search for foods and restaurants.

okay make sense you can remove one field and keep one then your in your controller you can do OR clause something like

$c = new CDbCriteria;
$c->compare('foods', $query, true, 'OR');
$c->compare('restaurants', $query, true);

NOTE: third bool param indicates where to do LIKE match or simple comparison