下拉状态将无法验证(php)

时间:2015-12-06 04:45:42

标签: javascript php mysql

每当我去完成表单时,状态下拉总是显示错误代码“你的状态是必需的”我需要这样做才能完成,所以我可以继续提交我的mysql查询。

我认为问题在于国家垮台,但我不确定这一点。

代码:

public function create()
    {   

        $id = Session::get('order');
        $order = Order::find($id);

        Session::put('order',$id);

        return View::make('pizza.create')
            ->with('order', $order);

    }

PHP

    <select required>
    <option value="select" name="select" title="select">Select A Option</option>>
    <option value="AL" name="AL" title="alabama">Alabama</option>
    <option value="AK" name="AK" title="alaska">Alaska</option>
    <option value="AZ" name="AZ" title="arizona">Arizona</option>
    <option value="AR" name="AR" title="arkansas">Arkansas</option>
    <option value="CA" name="CA" title="california">California</option>
    <option value="CO" name="CO" title="colorado">Colorado</option>
    <option value="CT" name="CT" title="connecticut">Connecticut</option>
    <option value="DE" name="DE" title="delware">Delaware</option>
    <option value="DC" name="DC" title="district of columbia">District Of Columbia</option>
    <option value="FL" name="FL" title="florida">Florida</option>
    <option value="GA" name="GA" title="georgia">Georgia</option>
    <option value="HI" name="HI" title="hawaii">Hawaii</option>
    <option value="ID" name="ID" title="idaho">Idaho</option>
    <option value="IL" name="IL" title="illinois">Illinois</option>
    <option value="IN" name="IN" title="indiana">Indiana</option>
    <option value="IA" name="IA" title="iowa">Iowa</option>
    <option value="KS" name="KA" title="kansas">Kansas</option>
    <option value="KY" name="KY" title="kentucky">Kentucky</option>
    <option value="LA" name="LA" title="louisiana">Louisiana</option>
    <option value="ME" name="ME" title="maine">Maine</option>
    <option value="MD" name="MD" title="maryland">Maryland</option>
    <option value="MA" name="MA" title="massachusetts">Massachusetts</option>
    <option value="MI" name="MI" title="michigan">Michigan</option>
    <option value="MN" name="MN" title="minnesota">Minnesota</option>
    <option value="MS" name="MS" title="mississippi">Mississippi</option>
    <option value="MO" name="MO" title="missouri">Missouri</option>
    <option value="MT" name="MT" title="montana">Montana</option>
    <option value="NE" name="NE" title="nebraska">Nebraska</option>
    <option value="NV" name="NV" title="nevada">Nevada</option>
    <option value="NH" name="NH" title="new hampshire">New Hampshire</option>
    <option value="NJ" name="NJ" title="new jersey">New Jersey</option>
    <option value="NM" name="NM" title="new mexico">New Mexico</option>
    <option value="NY" name="NY" title="new york">New York</option>
    <option value="NC" name="NC" title="north carolina">North Carolina</option>
    <option value="ND" name="ND" title="north dakota">North Dakota</option>
    <option value="OH" name="OH" title="ohio" selected>Ohio</option>
    <option value="OK" name="OK" title="oklahoma">Oklahoma</option>
    <option value="OR" name="OR" title="oregon">Oregon</option>
    <option value="PA" name="PA" title="pennsylvania">Pennsylvania</option>
    <option value="RI" name="RI" title="rhode island">Rhode Island</option>
    <option value="SC" name="SC" title="south carolina">South Carolina</option>
    <option value="SD" name="SD" title="south dakota">South Dakota</option>
    <option value="TN" name="TN" title="tennessee">Tennessee</option>
    <option value="TX" name="TX" title="texas">Texas</option>
    <option value="UT" name="UT" title="utah">Utah</option>
    <option value="VT" name="VT" title="vermont">Vermont</option>
    <option value="VA" name="VA" title="virginia">Virginia</option>
    <option value="WA" name="WA" title="washington">Washington</option>
    <option value="WV" name="WV" title="west virginia">West Virginia</option>
    <option value="WI" name="WI" title="wisconsin">Wisconsin</option>
    <option value="WY" name="WY" title="wyoming">Wyoming</option>
</select></td>
    <?php if(isset($nostate)) {echo "<span class='errormsg'>Your state is required<br></span>";}?>
</tr>

总是赞赏任何和所有帮助!

1 个答案:

答案 0 :(得分:1)

看起来您的问题可能与您声明选择框的方式有关。您对选择框名称的声明应该在select标记本身中。

你有:

<select required>
<option value="select" name="select" title="select">Select A Option</option>>

应该是:

<select required name="state">
<option value="select">Select A Option</option>