Echoing HTML select value not giving same value set

Question

I have this html select value that I used with AngularJS in building. Anytime I print the value selected from html in php, I keep getting a different thing. Eg. I selected Computer from the select group and the value="computer", when I echo in php, I get something like this:

? string: computer ?

I can't figure what the problem is. HTML code below

<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 code below:

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

        $department = $_POST['department'];

        echo $department;}

Show source
| javascript   | php   | html   | angularjs   2017-01-01 14:01 0 Answers

Answers ( 0 )

◀ Go back