Php用表格切换:逻辑错误?

I can't get my head around why this code doesn't keep toggling. What should be changed?

print_r( $_POST );
$direction = isset( $_POST['direction'] ) ? $_POST['direction'] : 'DESC';
$opposite = $direction == 'DESC' ? 'ASC' : 'DESC';
echo '
    <form method="POST" >
        <input type="submit" value="' . $opposite . ' " name="direction">
    </form>
';

The culprit is:

<input type="submit" value="' . $opposite . ' " name="direction">
                                            ^^

Notice how you've got an extra space at the end of the value, value="' . $opposite . ' "

Try changing it to:

echo '
    <form method="POST" >
        <input type="submit" value="' . $opposite . '" name="direction">
    </form>
';