How to access HTML input values from Twig and vice versa I am new to Craft and Twig in general. I have encountered the following problems and struggling to find a solution for hours.


I want to access the value of "foo" input field inside the twig delimiters to set the "json" variable.  
I want to change the "clicked" boolean, whenever the submit button is clicked.


The myFunc is a function that I am using from a custom plugin so it is not relative. 
I have commented what I've last tried and does not work for me.

I am using Craft 3, if that helps.

{% block body %}
    {% set clicked = false %}

    &lt;form name="search" action="{% set clicked = true %}"&gt;
        &lt;label for="foo"&gt;Foo&lt;/label&gt;
        &lt;input name="foo" type="text"/&gt;
        &lt;input type="submit" value="Get Json"/&gt;
        {#    &lt;a href="{{ set clicked = true }}"#}
    &lt;/form&gt;

    {% if clicked %}
        {% set json = jsonator_myFunc(search.foo.vars.value) %}
    {% endif %}

{% endblock %}


EDIT/SOLUTION:

A few more days into Craft CMS and chill and I realize how silly my question is. 

Thank you for the replies. The solution which I was looking for is:

craft.request.getParam('foo')
You can do it without JavaScript (if you don't mind the page refreshing) by accessing the request variable:

https://docs.craftcms.com/api/v3/craft-web-twig-variables-request.html#public-methods

{{ craft.app.request.getParam('foo') }} {# Should be the value of the input named 'foo' #}