将值传递给另一个php页面

时间:2017-05-05 11:16:03

标签: php html mysql

我想将值从一个页面传递到另一个页面。

    <form action="../PHP/sendemail.php" enctype="multipart/form-data" method="post">

    <table class="table" style="margin-bottom: 0">
    <tbody>
    <?php
    while($row=mysqli_fetch_assoc($res)){
    ?>
    <tr>
      <td style="vertical-align: middle;">
            <input type="text" id="email" name="email<?= $row['vacancyid'];?>" value='<?= $row['email'];?>'>
      </td>
      <td>
            <input type="submit" class="btn btn-info btn-sm" value="Apply Now" id="btn<?= $row['vacancyid']?>" name="btn<?= $row['vacancyid']?>">
      </td>
    <tr>
      <?php
      }
     ?>
    </tbody>
    </table>

sendmail.php

    <?php
    $email2 = $_POST['email'];
    ?>

我想知道get name =“发送电子邮件到sendemail.php页面。 谢谢

1 个答案:

答案 0 :(得分:0)

尝试将name用作数组:

  <form action="../PHP/sendemail.php" enctype="multipart/form-data" method="post">
        <table class="table" style="margin-bottom: 0">
        <tbody>
        <?php
        while($row=mysqli_fetch_assoc($res)){
        ?>
        <tr>
          <td style="vertical-align: middle;">
               <input type="text" id="email" name="email[]" value="<?= $row['email'];?>">
          </td>  
        </tr>
          <?php
          }
         ?>
      <tr>
     <input type="submit" class="btn btn-info btn-sm" value="Apply Now" id="btn" name="btn">
      </tr>
        </tbody>
        </table>
</form>

php文件:

<?php
$email = $_POST['email'];
print_r($email);
?>