0
votes

I'm currently extending a Site and do not have much experience with symfony.

Currently there is a Search-Form which looks like this:

<form id="search_huts_form" action="<?php echo url_for('hut/search') ?>" method="get">
  <fieldset>
    <legend><strong><?php echo __('Search huts') ?></strong></legend>
    <table id="spielplantabelle">
      <tr>
        <td><?php echo __('Your arrival date?') ?></td>
        <td>
          <select name="arrival">
            <option value=""><?php echo __('no preference') ?></option>
            <?php foreach ($checkInDates as $date): ?>
                <option value="<?php echo $date ?>"><?php echo $date ?></option>
            <?php endforeach; ?>
          </select>
    </table>
    <input type="submit" value="<?php echo __('Search') ?>" name="Submit" class="inputbuchen" />
  </fieldset>
</form>

Now I have to create a list of Categories below the search form with special offers which can also be found with the search function used in the form. This is what I have so far:

<ul>
    <?php foreach ($types as $typ): ?>
        <?php if (preg_match('#[0-9]#',$typ)): ?>
            <li> <a href="<?php echo url_for('hut/search') ?>"><?php echo($typ) ?></a> </li>
            <?php endif; ?>
    <?php endforeach; ?>
</ul>

The links correctly forward to the search page but I have no idea hot to set parameters based on the link a user clicks. Is this possible?

1

1 Answers

0
votes

I hope I get your problem right. You could add some additional url parameters to the link.

e.g.

<li> <a href="<?php echo url_for('hut/search?id='.$id) ?>"><?php echo($typ) ?>

You can then query this id on the page you've opened.

$request->getGetParameter('id');

Hope this helps.