从查询中访问单个变量

时间:2017-06-19 13:32:33

标签: php

我可以从数据库中获取两个值,一个easting和一个northing,并将它们格式化为:123456 | 123456.但是,我还希望将easting传递给$ easting变量,将northing传递给$ northing变量,以便我可以单独使用它们。我该怎么做?

到目前为止,这是我的代码。

<section id="aside" class="clearfix">
<section id="recipientcase">
<h3>Site Area: <?php if(isset($_POST['site_area'])){echo $_POST['site_area'];} ?></h3>
    <form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">
        <select id="Area_select" name="site_area" tabindex="1" class="selmenu" onchange="this.form.submit();">
        <option value="site_area">--- Area ---</option>
        <?php
        // postgresql database connection
        $area_array = pg_query($db_connection, "
            SELECT area_easting, area_northing
            FROM excavation.contexts 
            GROUP BY area_easting, area_northing
            ORDER BY area_easting ASC
            ");
            while ($row = pg_fetch_array($area_array)) {
                echo "<option>".$row['area_easting']." | ".$row['area_northing']."</option>";
                   }
        ?>          
        </select>

    </form>
</section>

1 个答案:

答案 0 :(得分:1)

根据OP的评论

进行编辑
var element = map.getTargetElement();
if (element.requestFullscreen) {
  element.requestFullscreen();
} else if (element.msRequestFullscreen) {
  element.msRequestFullscreen();
} else if (element.mozRequestFullScreen) {
  element.mozRequestFullScreen();
} else if (element.webkitRequestFullscreen) {
  element.webkitRequestFullscreen();
}

这将为您提供东向和北向的值,您可以在提交表单后将其分配给变量。您缺少选项的值属性