表格数据不是"发布"

时间:2016-04-15 00:37:01

标签: php html arrays forms

当我提交以下表单,并在单独的页面上打印POST数据的数组时,我得到一个空数组。我的数据在哪里,为什么不发布到flupdate.php?我测试了PHP及其声音。怎么了?

<form action="inc/flupdate.php" method="POST" name="form-wizard">
                            <div id="wizard">
                                <ol>
                                    <li>
                                        Identification 
                                        <small>Your personal information including name, description, tagline, etc..</small>
                                    </li>
                                    <li>
                                        Contact Information
                                        <small>Your home phone number and mobile phone number.</small>
                                    </li>
                                    <li>
                                        Login
                                        <small>Username and password information.</small>
                                    </li>
                                    <li>
                                        Completed
                                        <small>Final Stage! Submission and completion.</small>
                                    </li>
                                </ol>
                                <!-- begin wizard step-1 -->
                                <div class="wizard-step-1">
                                    <fieldset>
                                        <legend class="pull-left width-full">Identification</legend>
                                        <!-- begin row -->
                                        <div class="row">
                                            <!-- begin col-4 -->
                                            <div class="col-md-5">
                                                <div class="form-group block1">
                                                    <label>First Name</label>
                                                    <input type="text" name="firstname" placeholder="<?php if(!empty($_SESSION["user_first"])){ echo $_SESSION["user_first"];}else { echo 'First';} ?>" class="form-control" data-parsley-group="wizard-step-1" disabled />
                                                </div>
                                            </div>
                                            <!-- end col-4 -->
                                            <!-- begin col-4 -->
                                            <div class="col-md-5">
                                                <div class="form-group">
                                                    <label>Last Name</label>
                                                    <input type="text" name="lastname" placeholder="<?php if(!empty($_SESSION["user_last"])){ echo $_SESSION["user_last"];}else { echo 'Last';} ?>" class="form-control" data-parsley-group="wizard-step-1" disabled />
                                                </div>
                                            </div>
                                            <!-- end col-4 -->
                                        </div>
                                        <div class="row">
                                            <!-- begin col-4 -->
                                            <div class="col-md-5">
                                                <div class="form-group block1">
                                                    <label>Email &#x271D;</label>
                                                    <input type="text" name="email" placeholder="<?php if(!empty($_SESSION["user_email"])){ echo $_SESSION["user_email"];}else { echo 'Email';} ?>" class="form-control" data-parsley-group="wizard-step-1" disabled />
                                                </div>
                                            </div>
                                            <div class="col-md-2">
                                                <div class="form-group block1">
                                                    <label>Gender</label>
                                                    <select name="gender" class="form-control" <?php if(!empty($_SESSION["user_gender"])){ echo 'disabled'; }else { echo 'required'; }?>>
                                                        <option value="Male" <?php if($_SESSION["user_gender"] == 'Male'){ echo 'selected="selected"'; } ?>>Male</option>
                                                        <option value="Female" <?php if($_SESSION["user_gender"] == 'Female'){ echo 'selected="selected"'; } ?>>Female</option>
                                                        <option value="(trans) Male to Female" <?php if($_SESSION["user_gender"] == '(trans) Male to Female'){ echo 'selected="selected"'; } ?>>(trans) Male to Female</option>
                                                        <option value="(trans) Female to Male" <?php if($_SESSION["user_gender"] == '(trans) Female to Male'){ echo 'selected="selected"'; } ?>>(trans) Female to Male</option>
                                                        <option value="Other" <?php if($_SESSION["user_gender"] == 'Other'){ echo 'selected="selected"'; } ?>>Other</option>
                                                    </select>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="row">
                                            <!-- begin col-4 -->
                                            <div class="col-md-4">
                                                <div class="form-group block1">
                                                    <label>City</label>
                                                    <input type="text" name="city" placeholder="<?php if(!empty($_SESSION["user_city"])){ echo $_SESSION["user_city"];}else { echo 'City';} ?>" class="form-control" data-parsley-group="wizard-step-1" <?php if(!empty($_SESSION["user_city"])){ echo 'disabled'; }else { echo 'required'; }?> />
                                                </div>
                                            </div>
                                            <!-- end col-4 -->
                                            <!-- begin col-4 -->
                                            <div class="col-md-4">
                                                <div class="form-group">
                                                    <label>State</label>
                                                    <select name="state" class="form-control" <?php if(!empty($_SESSION["user_city"])){ echo 'disabled'; }else { echo 'required'; }?>>
                                                        <option value="AL" <?php if($_SESSION["user_state"] == 'AL'){ echo 'selected="selected"'; } ?>>Alabama</option>
                                                        <option value="AK" <?php if($_SESSION["user_state"] == 'AK'){ echo 'selected="selected"'; } ?>>Alaska</option>
                                                        <option value="AZ" <?php if($_SESSION["user_state"] == 'AZ'){ echo 'selected="selected"'; } ?>>Arizona</option>
                                                        <option value="AR" <?php if($_SESSION["user_state"] == 'AR'){ echo 'selected="selected"'; } ?>>Arkansas</option>
                                                        <option value="CA" <?php if($_SESSION["user_state"] == 'CA'){ echo 'selected="selected"'; } ?>>California</option>
                                                        <option value="CO" <?php if($_SESSION["user_state"] == 'CO'){ echo 'selected="selected"'; } ?>>Colorado</option>
                                                        <option value="CT" <?php if($_SESSION["user_state"] == 'CT'){ echo 'selected="selected"'; } ?>>Connecticut</option>
                                                        <option value="DE" <?php if($_SESSION["user_state"] == 'DE'){ echo 'selected="selected"'; } ?>>Delaware</option>
                                                        <option value="DC" <?php if($_SESSION["user_state"] == 'DC'){ echo 'selected="selected"'; } ?>>District Of Columbia</option>
                                                        <option value="FL" <?php if($_SESSION["user_state"] == 'FL'){ echo 'selected="selected"'; } ?>>Florida</option>
                                                        <option value="GA" <?php if($_SESSION["user_state"] == 'GA'){ echo 'selected="selected"'; } ?>>Georgia</option>
                                                        <option value="HI" <?php if($_SESSION["user_state"] == 'HI'){ echo 'selected="selected"'; } ?>>Hawaii</option>
                                                        <option value="ID" <?php if($_SESSION["user_state"] == 'ID'){ echo 'selected="selected"'; } ?>>Idaho</option>
                                                        <option value="IL" <?php if($_SESSION["user_state"] == 'IL'){ echo 'selected="selected"'; } ?>>Illinois</option>
                                                        <option value="IN" <?php if($_SESSION["user_state"] == 'IN'){ echo 'selected="selected"'; } ?>>Indiana</option>
                                                        <option value="IA" <?php if($_SESSION["user_state"] == 'IA'){ echo 'selected="selected"'; } ?>>Iowa</option>
                                                        <option value="KS" <?php if($_SESSION["user_state"] == 'KS'){ echo 'selected="selected"'; } ?>>Kansas</option>
                                                        <option value="KY" <?php if($_SESSION["user_state"] == 'KY'){ echo 'selected="selected"'; } ?>>Kentucky</option>
                                                        <option value="LA" <?php if($_SESSION["user_state"] == 'LA'){ echo 'selected="selected"'; } ?>>Louisiana</option>
                                                        <option value="ME" <?php if($_SESSION["user_state"] == 'ME'){ echo 'selected="selected"'; } ?>>Maine</option>
                                                        <option value="MD" <?php if($_SESSION["user_state"] == 'MD'){ echo 'selected="selected"'; } ?>>Maryland</option>
                                                        <option value="MA" <?php if($_SESSION["user_state"] == 'MA'){ echo 'selected="selected"'; } ?>>Massachusetts</option>
                                                        <option value="MI" <?php if($_SESSION["user_state"] == 'MI'){ echo 'selected="selected"'; } ?>>Michigan</option>
                                                        <option value="MN" <?php if($_SESSION["user_state"] == 'MN'){ echo 'selected="selected"'; } ?>>Minnesota</option>
                                                        <option value="MS" <?php if($_SESSION["user_state"] == 'MS'){ echo 'selected="selected"'; } ?>>Mississippi</option>
                                                        <option value="MO" <?php if($_SESSION["user_state"] == 'MO'){ echo 'selected="selected"'; } ?>>Missouri</option>
                                                        <option value="MT" <?php if($_SESSION["user_state"] == 'MT'){ echo 'selected="selected"'; } ?>>Montana</option>
                                                        <option value="NE" <?php if($_SESSION["user_state"] == 'NE'){ echo 'selected="selected"'; } ?>>Nebraska</option>
                                                        <option value="NV" <?php if($_SESSION["user_state"] == 'NV'){ echo 'selected="selected"'; } ?>>Nevada</option>
                                                        <option value="NH" <?php if($_SESSION["user_state"] == 'NH'){ echo 'selected="selected"'; } ?>>New Hampshire</option>
                                                        <option value="NJ" <?php if($_SESSION["user_state"] == 'NJ'){ echo 'selected="selected"'; } ?>>New Jersey</option>
                                                        <option value="NM" <?php if($_SESSION["user_state"] == 'NM'){ echo 'selected="selected"'; } ?>>New Mexico</option>
                                                        <option value="NY" <?php if($_SESSION["user_state"] == 'NY'){ echo 'selected="selected"'; } ?>>New York</option>
                                                        <option value="NC" <?php if($_SESSION["user_state"] == 'NC'){ echo 'selected="selected"'; } ?>>North Carolina</option>
                                                        <option value="ND" <?php if($_SESSION["user_state"] == 'ND'){ echo 'selected="selected"'; } ?>>North Dakota</option>
                                                        <option value="OH" <?php if($_SESSION["user_state"] == 'OH'){ echo 'selected="selected"'; } ?>>Ohio</option>
                                                        <option value="OK" <?php if($_SESSION["user_state"] == 'OK'){ echo 'selected="selected"'; } ?>>Oklahoma</option>
                                                        <option value="OR" <?php if($_SESSION["user_state"] == 'OR'){ echo 'selected="selected"'; } ?>>Oregon</option>
                                                        <option value="PA" <?php if($_SESSION["user_state"] == 'PA'){ echo 'selected="selected"'; } ?>>Pennsylvania</option>
                                                        <option value="RI" <?php if($_SESSION["user_state"] == 'RI'){ echo 'selected="selected"'; } ?>>Rhode Island</option>
                                                        <option value="SC" <?php if($_SESSION["user_state"] == 'SC'){ echo 'selected="selected"'; } ?>>South Carolina</option>
                                                        <option value="SD" <?php if($_SESSION["user_state"] == 'SD'){ echo 'selected="selected"'; } ?>>South Dakota</option>
                                                        <option value="TN" <?php if($_SESSION["user_state"] == 'TN'){ echo 'selected="selected"'; } ?>>Tennessee</option>
                                                        <option value="TX" <?php if($_SESSION["user_state"] == 'TX'){ echo 'selected="selected"'; } ?>>Texas</option>
                                                        <option value="UT" <?php if($_SESSION["user_state"] == 'UT'){ echo 'selected="selected"'; } ?>>Utah</option>
                                                        <option value="VT" <?php if($_SESSION["user_state"] == 'VT'){ echo 'selected="selected"'; } ?>>Vermont</option>
                                                        <option value="VA" <?php if($_SESSION["user_state"] == 'VA'){ echo 'selected="selected"'; } ?>>Virginia</option>
                                                        <option value="WA" <?php if($_SESSION["user_state"] == 'WA'){ echo 'selected="selected"'; } ?>>Washington</option>
                                                        <option value="WV" <?php if($_SESSION["user_state"] == 'WV'){ echo 'selected="selected"'; } ?>>West Virginia</option>
                                                        <option value="WI" <?php if($_SESSION["user_state"] == 'WI'){ echo 'selected="selected"'; } ?>>Wisconsin</option>
                                                        <option value="WY" <?php if($_SESSION["user_state"] == 'WY'){ echo 'selected="selected"'; } ?>>Wyoming</option>
                                                    </select>
                                                </div>
                                            </div>
                                            <!-- end col-4 -->
                                        </div><br>
                                        <div class="row">
                                            <!-- begin col-4 -->
                                            <div class="col-md-9">
                                                <div class="form-group block1">
                                                    <label>About You</label>
                                                    <textarea cols="80" rows="5" type="text" name="description" placeholder="<?php if(!empty($_SESSION["user_desc"])){ echo $_SESSION["user_desc"];}else { echo 'Decribe you!';} ?>" class="form-control" data-parsley-group="wizard-step-1" <?php if(!empty($_SESSION["user_desc"])){ echo 'disabled'; }else { echo 'required'; }?> /></textarea>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="row">
                                            <div class="col-md-6">
                                                <div class="form-group block1">
                                                    <label>Tagline</label>
                                                    <input type="text" name="city" placeholder="<?php if(!empty($_SESSION["user_tagline"])){ echo $_SESSION["user_tagline"];}else { echo 'City';} ?>" class="form-control" data-parsley-group="wizard-step-1" <?php if(!empty($_SESSION["user_tagline"])){ echo 'disabled'; }else { echo 'required'; }?> />
                                                </div>
                                            </div>
                                        </div><br>
                                        <p>&#x271D; Wont be displayed to students</p>
                                        <!-- end row -->
                                    </fieldset>
                                </div>
                                <!-- end wizard step-1 -->
                                <!-- begin wizard step-2 -->
                                <div class="wizard-step-2">
                                    <fieldset>
                                        <legend class="pull-left width-full">Contact Information</legend>
                                        <!-- begin row -->
                                        <div class="row">
                                            <!-- begin col-4 -->
                                            <div class="col-md-4">
                                                <div class="form-group block1">
                                                    <label>Mobile Phone &#x271D;</label>
                                                    <input type="text" name="firstname" placeholder="<?php if(!empty($_SESSION["user_mobile"])){ echo $_SESSION["user_mobile"];}else { echo 'Mobile';} ?>" class="form-control" data-parsley-group="wizard-step-1" <?php if(!empty($_SESSION["user_mobile"])){ echo 'disabled'; }else { echo 'required'; }?> />
                                                </div>
                                            </div>
                                            <div class="col-md-4">
                                                <div class="form-group block1">
                                                    <label>Home Phone &#x271D;</label>
                                                    <input type="text" name="firstname" placeholder="<?php if(!empty($_SESSION["user_home"])){ echo $_SESSION["user_home"];}else { echo 'Home';} ?>" class="form-control" data-parsley-group="wizard-step-1" <?php if(!empty($_SESSION["user_home"])){ echo 'disabled'; }else { echo 'required'; }?> />
                                                </div>
                                            </div>
                                        </div><br>
                                        <p>&#x271D; Wont be displayed to students</p>
                                        <!-- end row -->
                                    </fieldset>
                                </div>
                                <!-- end wizard step-2 -->
                                <!-- begin wizard step-3 -->
                                <div class="wizard-step-3">
                                    <fieldset>
                                        <legend class="pull-left width-full">Login</legend>
                                        <!-- begin row -->
                                        <div class="row">
                                            <!-- begin col-4 -->
                                            <div class="col-md-4">
                                                <div class="form-group">
                                                    <label>Username</label>
                                                    <div class="controls">
                                                        <input type="text" name="username" placeholder="<?php if(!empty($_SESSION["user_name"])){ echo $_SESSION["user_name"];}else { echo 'Username';} ?>" class="form-control" data-parsley-group="wizard-step-3" <?php if(!empty($_SESSION["user_home"])){ echo 'disabled'; }else { echo 'required'; }?> />
                                                    </div>
                                                </div>
                                            </div>
                                            <!-- end col-4 -->
                                            <!-- begin col-4 -->
                                            <div class="col-md-4">
                                                <div class="form-group">
                                                    <label>Pasword</label>
                                                    <div class="controls">
                                                        <input type="password" name="password" placeholder="Disabled" class="form-control" data-parsley-group="wizard-step-3" disabled />
                                                    </div>
                                                </div>
                                            </div>
                                            <!-- end col-4 -->
                                            <!-- begin col-4 -->
                                            <div class="col-md-4">
                                                <div class="form-group">
                                                    <label>Confirm Pasword</label>
                                                    <div class="controls">
                                                        <input type="password" name="password2" placeholder="Disabled" class="form-control" disabled />
                                                    </div>
                                                </div>
                                            </div>
                                            <!-- end col-6 -->
                                        </div><br>
                                        <p>&#x271D; Wont be displayed to students</p>
                                        <!-- end row -->
                                    </fieldset>
                                </div>
                                <!-- end wizard step-3 -->
                                <!-- begin wizard step-4 -->
                                <div>
                                    <div class="jumbotron m-b-0 text-center">
                                        <h1>Finish Login</h1><br>
                                        <input value="Proceed to User Profile" role="button" class="btn btn-success btn-lg" type="submit">
                                    </div>
                                </div>
                                <!-- end wizard step-4 -->
                            </div>
                        </form>

1 个答案:

答案 0 :(得分:0)

您可以使用html属性 readonly 而不是disabled。无法修改只读输入字段(但是,用户可以对其进行制表,突出显示,并从中复制文本)。

例如:

<input type="text" name="firstname" placeholder="<?php if(!empty($_SESSION["user_first"])){ echo $_SESSION["user_first"];}else { echo 'First';} ?>" class="form-control" data-parsley-group="wizard-step-1" readonly />