回应HTML选择值不给出相同的值集

时间:2017-01-01 13:41:55

标签: javascript php html angularjs

我在构建时使用了AngularJS的html选择值。任何时候我打印从PHP中的html中选择的值,我不断得到一个不同的东西。例如。我从选择组中选择了计算机,而值=“计算机”,当我在php中回显时,我得到这样的结果:

  

?字符串:电脑?

我无法确定问题所在。

下面的HTML代码
<div class="form-group" form-group-sm>
    <label>Faculty/School:</label>
    <select name="faculty" class="form-control" ng-model="tfaculty">
        <option value="Engineering">Faculty of Engineering</option>
        <option value="Medicine">Faculty of Medicine</option>
        <option value="Agriculture">Faculty of Agriculture</option>
        <option value="Bioscience">Faculty of Bioscience</option>
        <option value="Physical Science">Faculty of Physical Science</option>
        <option value="Law">Faculty of Law</option>
        <option value="Mgt Tech">Faculty of Management Sci./Tech.</option>
        <option value="Soc. Science">Faculty of Social Science</option>
        <option value="Health Sci.">Faculty of Health Sci. and Tech.</option>
        <option value="Envt Tech">Faculty of Environmental Sci./Tech.</option>
        <option value="Education">Faculty of Education</option>
        <option value="Arts">Faculty of Arts</option>                                                                  
    </select>
</div>
<!--this section shows to choose department-->
<div class="form-group" form-group-sm>
    <span ng-show="tfaculty == 'Engineering'">
        <label>Department:</label>
        <select name="department" class="form-control" ng-model="tdepartment">
            <option value="Elect Elect Eng">Electrical and Electronics</option>
            <option value="Computer Eng">Computer Engineering</option>
            <option value="Chemical Eng">Chemical Engineering</option>
            <option value="Civil Eng">Civil Engineering</option>
            <option value="Petroleum Eng">Petroleum Engineering</option>
            <option value="Mechanical Eng">Mechanical Engineering</option>
            <option value="Polymer Eng">Polymer and Textile</option>
            <option value="Met Mat Eng">Material and Metallurgical</option>
            <option value="Agric and Bio">Agric and BioResources</option>
            <option value="Mechatronics Eng">Mechatronics Engineering</option>                                                       
        </select>
    </span>
    <span ng-show="tfaculty == 'Medicine'">
        <label>Department:</label>
        <select name="department" class="form-control" ng-model="tdepartment">
            <option value="Surgery">Surgery</option>
            <option value="Anaesthesiology">Anaesthesiology</option>
            <option value="Chemical Pathology">Chemical Pathology</option>
            <option value="Haematology">Haematology</option>
            <option value="Histopathology">Histopathology</option>
            <option value="Medicine">Medicine</option>
            <option value="pthamology">Opthamology</option>
            <option value="Paediatrics">Paediatrics</option>
            <option value="Radiology">Radiology</option>
            <option value="Medical Microbiology">Medical Microbiology</option>
            <option value="Anatomy">Anatomy</option>
            <option value="Physiology">Physiology</option>
        </select>
    </span>
    <span ng-show="tfaculty == 'Agriculture'">
        <label>Department:</label>
        <select name="department" class="form-control" ng-model="tdepartment">
            <option value="Agric Economics">Agric Economics and Extension</option>
            <option value="Crop Science">Crop Science and Horticulture</option>
            <option value="Animal Science">Animal Science</option>
            <option value="Forestry">Forestry and Widelife</option>
            <option value="Fisheries">Fisheries and Aquaculture</option>
            <option value="Food Science">Food Science and Technology</option>
            <option value="Soil Science">Soil Science and Land Resources</option>
        </select>
    </span>

以下PHP代码:

if (isset($_POST['search'])) { //narrowing d search by department

        $department = $_POST['department'];

        echo $department;}

0 个答案:

没有答案