简体   繁体   中英

how to get data from a specific table html $_POST[] in the form PHP

In form I have two table in form, for example table#1, table#2. both tables are sent only one $_POST. How to get data form eg table#1 ? Is it possible to select in some way in $ _POST ['table # 1']?

<form id="prepForm" action="" method="POST">
<table id="1" class="table tabele-conclusions table-bordered">
    <thead>
        <tr>
            <th>Lp.</th>
            <th>desc</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <th scope="row">1</th>
            <td><input name="row1_desc" value=""/></td>
        </tr>
    </tbody>
</table>
<table id="2" class="table tabele-conclusions table-bordered">
    <thead>
        <tr>
            <th>Lp.</th>
            <th>desc</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <th scope="row">2</th>
            <td><input name="row2_desc" value=""/></td>
        </tr>
    </tbody>
</table>

Simple examples:

Html

<form action="/post.php" method="POST">
   <input type="text" name="testinput" value="Hello world!" />
</form>

Php:

<?php
  echo $_POST["testinput"]; // Hello world!
?>

Edit: When I gave this reply, there was no sample code in the question.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM