-2

i want to pass values from one page to another page.

    <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'];
    ?>

i eant to know get name="email to sendemail.php page. thank you

Intern
  • 19
  • 9

1 Answers1

0

Try to use name as a array:

  <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 file:

<?php
$email = $_POST['email'];
print_r($email);
?>
Ahmed Ginani
  • 6,522
  • 2
  • 15
  • 33
  • ..sorry for previous informayion.i want to send one email in one time.when i use name="email" every emil goes to same email address. – Intern May 05 '17 at 11:26