lolka
lolka

Reputation: 3

Php get request doesnt work

could you please help me, I am editing a smarty template with bootstrap controls and want to make a simple php form, with get method. however when the button is clicked the form isn't submitted, the url in browser just adds '?' and no key-values are added after.

Please take a look, tell me what am i doing wrong, thx!

<div class="form-horizontal">
        <form method="get" role="form" name="form">
        <div class='row'>
            <p class="col-md-2"> Количество членов партии:</p>
            <div class='col-md-2'>
                <div class="form-group">
                    <label for="from" class="col-sm-1">{'От'|t}:</label>
                    <div class="col-sm-10">
                        <input type="text" id='from' class='form-control'>
                    </div>
                </div>
            </div>

            <div class='col-md-2'>
                <div class="form-group">
                    <label for="to" class="col-sm-1">{'До'|t}:</label>
                    <div class="col-sm-10">
                        <input type="text" id='to' class='form-control'>
                    </div>
                </div>
            </div>
            <input class="btn btn-primary" type='submit' value='{"Фильтр"|t}' />
        </div>
        </form>

Upvotes: 0

Views: 60

Answers (2)

3y3skill3r
3y3skill3r

Reputation: 1026

You need to add "name" for input.

<input type="text" id='to' name='to' class='form-control'>

After request is executed, "name" will be shown in url:

http://someurl.sk/action?to=[valueFromInputWwithName'to']

Upvotes: 1

Pupil
Pupil

Reputation: 23948

You have forgot to create form.

Please add <form name="">

Also, check that all your fields have name attributes.

in your code.

Upvotes: 0

Related Questions