简体   繁体   中英

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>

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']

You have forgot to create form.

Please add <form name="">

Also, check that all your fields have name attributes.

in your code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM