i have this code in indexSucces.php
//some html for the main page
<td width='48%' align='right'>
<?php include_partial('login', array('form' => $form)) ?>
</td>
in the actions.class.php for index i have:
public function executeIndex()
{
$this->form = new RcLoginForm();
$this->setTemplate('index');
$this->search_form = new RcSearchForm();
$this->age_form = new RcAgeTableForm();
}
public function executeListmatches(sfWebRequest $request)
{
}
then the partial _login.php code:
<form action="<?php echo url_for('password/listmatches' ) ?>" method="post" >
<tr>
<td colspan="2">
<span class='spn_med_lightblue_rbc'>I am a:</span>
<select id="gender1" name="gender1">
<option value="male1" >Male</option>
<option value="female1" selected="selected">Female</option>
</select>
</td>
</tr>
<tr>
<td colspan="2">
<span class='spn_med_lightblue_rbc'>Seeking a:</span>
<select id="gender2" name="gender2">
<option value="male2" >Male</option>
<option value="female2" selected="selected">Female</option>
</select>
</td>
</tr>
<tr>
<td>
<span class='spn_med_lightblue_rbc'>Age:</span>
<select id="age1" name="age1">
<?php $ages = RcAgeTablePeer::getById(18);
foreach ($ages as $age)
{
//echo $age->getId();
echo "<option>";
echo $age->getId();
echo "</option>";
} ?>
</select>
</td>
<td>
<span class='spn_med_lightblue_rbc'>To:</span>
<select id="age2" name="age2">
<?php foreach ($ages as $age)
{
//echo $age->getId();
echo "<option>";
echo $age->getId();
echo "</option>";
} ?>
</select>
</td>
</tr>
<tr>
<td colspan="2">
<span class='spn_med_lightblue_rbc'>Location:</span>
<select id="province" name="province">
<option value="all" selected="selected">All</option>
<option value="ec">Eastern Cape</option>
<option value="nc">Northern Cape</option>
<option value="wc">Western Cape</option>
<option value="fs">Free State</option>
<option value="gp">Gauteng</option>
<option value="kzn">Kzn</option>
<option value="lim">Limpopo</option>
<option value="mpu">Mpumulanga</option>
<option value="nw">North West</option>
</select>
</td>
<td><input class='submit_img' type="image" src="/images/rainbow/gobuttonbluesmall.png" value="Submit" alt="Submit"></td>
</tr>
<tr></tr>
<tr></tr>
</form>
the above will give a home page with a section(the partial _login) that contains the login to the website and also a quick search when you hit the go button the form action will go to
action=”
this is my dilemma..i am not in any class, i just pass on the selected values through POST and use those values to get my rows
in listmatchesSuccess.php
$matching_rows = RcProfileTablePeer::getAllBySelection($gender_id2,$age1,$age2,$province_id,$from,$limit);
where above in RcProfileTablePeer.php:
static public function getAllBySelection($gender2,$age1,$age2,$province_id,$from,$limit)
{
$criteria = new Criteria();
$criteria->add(RcProfileTablePeer::AGE,$age1,Criteria::GREATER_EQUAL);
$criteria->add(RcProfileTablePeer::AGE,$age2,Criteria::LESS_EQUAL);
$criteria->add(RcProfileTablePeer::GENDER_ID,$gender2, Criteria::EQUAL);
if ($province_id <> 10)
$criteria->addAnd(RcProfileTablePeer::PROVINCE_ID,$province_id, Criteria::EQUAL);
$criteria->setLimit($limit);
return self::doSelect($criteria);
}
hope all this makes better sense now 🙂
thank you
There is an error in your query:
Resulting query:
rc_profile.age >= :age1.If you are looking for the objects with age between $age1 and $age2, this should do the trick:
Resulting query:
rc_profile.age >= :age1 AND rc_profile.age <= :age2Note that you should use
$criteria->addAndor$criteria->addOrto combine the conditions FOR THE SAME COLUMN.