How can i pass data to another page?

I have a shop-skeleton and i have a button “I want this” in the details page, it redirects to a form page where they can send contact info if they want to buy this item. How can i pass the item ID to that page?

in php I would just use GET or POST but can’t manage to do this with grav and twig and markdown…

Really no one can help me do this very basic thing? is there a way to use PHP in twig or md?

Okay I found solution.
You can pass data in page links as PARAMS and get them in twig with uri.param(‘param-name’) .

Reference: http://learn.getgrav.org/themes/theme-vars

Glad you found it out!

Now I have another problem.
Is it possible to populate form dynamically?

I want to add the product name in the form, but the form is made already with form plugin.
Can I update a field with twig?

Not out of the box.
One way to do it is to provide your own templates/forms/default/form.html.twig (the base file that usually defines the form markup) and for example change its markup to


{% for field in form.fields %}
    {% set value = form.value(field.name) %}

    {% if field.name == 'name' %}
      {% set value = 'xxxx' %}
    {% endif %}
    <div>
        {% include "forms/fields/#{field.type}/#{field.type}.html.twig" %}
    </div>
{% endfor %}

and instead of ‘xxxx’ put your logic to grab the value you want to add.

Thanks, it works!