如何在 PHP 页面重新加载中获取选定的选项值

how to Get selected option value within PHP page reload

<div class="form-group row">
    <label for="event_name" class="col-sm-2  col-md-1 col-form-label">Event Name</label>
    <div class="col-sm-4 col-md-4">
        <select class="form-control event" name='event_name' id='event_name'>
            <option value="Option_1">Option 1</option>
            <option value="Option_2">Option 2</option>
            <option value="Option_3">Option 3</option>
            <option value="Option_4">Option 4</option>
            <option value="Option_5">Option 5</option>
        </select>
    </div>
</div>

<h4>{Event name}</h4>

我的问题是当我 select 任何选项时如何获得{Event name}?

您可以轻松地使用表单中的会话。只需在顶部做一些事情,例如:

<?php
if (isset($_GET['form'])) {
   $_SESSION['eName'] = $_GET['event_name'];
}
?>

<div class="form-group row">
    <label for="event_name" class="col-sm-2  col-md-1 col-form-label">Event Name</label>
    <div class="col-sm-4 col-md-4">
    <form method="GET" action="">
        <select class="form-control event" name='event_name' id='event_name'>
            <option value="Option_1">Option 1</option>
            <option value="Option_2">Option 2</option>
            <option value="Option_3">Option 3</option>
            <option value="Option_4">Option 4</option>
            <option value="Option_5">Option 5</option>
        </select>
        <input type="submit" name="form">
    </form>
    </div>
</div>

<h4><?php if(isset($_SESSION['eName'])) { echo $_SESSION['eName']; }?></h4>

我得到了我的答案,这是为了不提交价值

<?PHP
    $event_name = $_GET['event_name'];
?>

<script>
jQuery(function($){

    $('#event_name').change(function(e){
        let event_name = e.target.value;
        window.location.href = `/wp-admin/admin.php?pageName&event_name=${event_name}`;
    });
}
</script>