HTML表单:value属性不会更改发送到php的内容

so I'm having problems with forms sending data to my php script.

My html is:

<form method="get" action="form.php">
    <select name="course">
        <option value"COMM1">COMM1111</option>
        <option value"COMM2">COMM2222</option>
        <option value"COMM3">COMM3333</option>
        <option value"COMM4">COMM4444</option>
    </select>
</form>

What's sent to form.php when I do

$_GET['course']

is the inner text of the chosen option.

So choosing COMM1111 gives me COMM1111 instead of COMM1

In your option tag you forgot your equal sign for value

<option value = "COMM1">COMM1111</option>

You are missing the = sign in your HTML for the value of the options.

Consider the following code which produces the values you are looking for ::

HTML:

<form method="get">
    <select name="course">
        <option value="COMM1">COMM1111</option>
        <option value="COMM2">COMM2222</option>
        <option value="COMM3">COMM3333</option>
        <option value="COMM4">COMM4444</option>
    </select>
    <input type='submit'>
</form>

PHP:

<?php
    if(!empty($_GET)){
        print_r($_GET);
    }
?>