从窗体中获取值并仅打印选中的值


getting a value from a form and printing the checked values only

我需要获取用户选中的复选框值并打印它们。

我目前正在做什么在下面,但我不确定在表单中编写操作脚本

<form id="shop" method="POST" action="">
  <section id="latest" class="last clear">
    <article class="one_quarter">
      <figure><img src="images/g1.jpg" width="215" height="100" alt="">
        <figcaption>
          Value : $100 <br />
          Price : $75.00
          <input type="checkbox" name="one" />
          <br />
          <footer class="more"><a href="#">Read More &raquo;</a></footer>
        </figcaption>
      </figure>
    </article>
    <article class="one_quarter">
      <figure><img src="images/g2.jpg" width="215" height="100" alt="">
        <figcaption>
           Value : $100 <br />
          Price : $82.00
          <input type="checkbox" name="two" />
          <br />
          <footer class="more"><a href="#">Read More &raquo;</a></footer>
        </figcaption>
      </figure>
    </article>

在同一

目录中创建一个类似"result.php"的文件

使"结果.php"的操作

结果.php:

if(isset($_POST["one"])){
    echo $_POST["one"];
}
 if(isset($_POST["two"])){
    echo $_POST["two"];
}