How to send a table / form with a grouping / identifier for subsequent receipt

I am trying to write html5 and PHP for a form that a user can fill out. When they fall into submit, I want to have a general rating category, that every 5 columns are grouped under what I can get. For instance:

<parameters>
  <parameterID>9214</parameterID>
  <parameter>MC Bands</parameter>
  <Yevaluation/>
  <Mevaluation/>
  <Cevaluation/>
  <Kevaluation/>
  <comments/>
</parameters>
<parameters>
  <parameterID>9245</parameterID>
  <parameter>MC Streaks</parameter>
  <Yevaluation/>
  <Mevaluation/>
  <Cevaluation/>
  <Kevaluation/>
  <comments/>
</parameters>

I am having trouble getting it in the form and input table, so I can get it later for the category identifier. I was going to go to a hidden cell, but she entered the value in the first cell of the table.

This is in table.php:

<form  method="get" action="visEupload.php">
<table id="bigTable" border="1">
    <thead>
     <tr>
     <th id="bandY" class="col3">Bands @263mm Y</th>
     <th id="bandM" class="col3">Bands @263mm M</th>
     <th id="bandC" class="col3">Bands @263mm C</th>
     <th id="bandK" class="col3">Bands @263mm K</th>
     <th id="Comments" class="col3">Comments</th>
     </tr>
    </thead>
    <tbody>
        <tr>
            <td><input name="MCBands" value="9214" id="MCBands" visibility=hidden> <!--this isn't showing up as hidden-->
            <td><input name="Yevaluation" ></td>  //Row 0 Column 1
            <td><input name="Mevaluation" ></td>  //Row 0 Column 2
            <td><input name="Cevaluation" ></td>  //Row 0 Column 3
            <td><input name="Kevaluation" ></td>  //Row 0 Column 4
            <td><input name="comment" ></td>  //Row 0 Column 4
            <!--the above rows will repeat with different id's/names/values/cells, ex. streaks and will be really wide-->
        </tr>
    </tbody>

</table>
  <input id="submit" type="submit" class="list" name="submit" value="Submit To Database" >  

</form>

I am having trouble finding a good example with the table data provided with the form. I saw this, but these are different html tables .

, submit, visEupload.php, , , , ID, :

if (isset($_GET['submit'])){
        $Yevaluation= $_GET['Yevaluation'];
        $Mevaluation= $_GET['Mevaluation'];
        $Cevaluation= $_GET['Cevaluation'];
        $Kevaluation= $_GET['Kevaluation'];
        $MCBands= $_GET['MCBands'];
        $comment=$_GET['comment'];

        echo "here:".$Yevaluation.$Mevaluation.$Cevaluation.$Kevaluation.$MCBands.$comment;

        echo "here1";

        echo ("visE upload requested");

    } //submit is set
0
1

, :

<table id="bigTable" border="1">
    <thead>
     <tr>
     <th id="bandY" class="col3">Bands @263mm Y</th>
     <th id="bandM" class="col3">Bands @263mm M</th>
     <th id="bandC" class="col3">Bands @263mm C</th>
     <th id="bandK" class="col3">Bands @263mm K</th>
     <th id="Comments" class="col3">Comments</th>
     </tr>
    </thead>
    <tbody>
        <tr>
            <td><input name="MCBands[]" value="9214" id="MCBands" type="hidden"> 
            <td><input name="Yevaluation[]" value=""></td>  //Row 0 Column 1
            <td><input name="Mevaluation[]" value=""></td>  //Row 0 Column 2
            <td><input name="Cevaluation[]" value=""></td>  //Row 0 Column 3
            <td><input name="Kevaluation[]" value=""></td>  //Row 0 Column 4
            <td><input name="comment[]" value=""></td>  //Row 0 Column 4
        </tr>
        <tr>
            <td><input name="MCBands[]" value="9215" id="MCBands" type="hidden">
            <td><input name="Yevaluation[]" value=""></td>  //Row 0 Column 1
            <td><input name="Mevaluation[]" value=""></td>  //Row 0 Column 2
            <td><input name="Cevaluation[]" value=""></td>  //Row 0 Column 3
            <td><input name="Kevaluation[]" value=""></td>  //Row 0 Column 4
            <td><input name="comment[]" value=""></td>  //Row 0 Column 4
        </tr>
        <tr>
            <td><input name="MCBands[]" value="9214" id="MCBands" type="hidden">
            <td><input name="Yevaluation[]" value=""></td>  //Row 0 Column 1
            <td><input name="Mevaluation[]" value=""></td>  //Row 0 Column 2
            <td><input name="Cevaluation[]" value=""></td>  //Row 0 Column 3
            <td><input name="Kevaluation[]" value=""></td>  //Row 0 Column 4
            <td><input name="comment[]" value=""></td>  //Row 0 Column 4
        </tr>
    </tbody>

</table>

:

if (isset($_GET['submit'])){
    $arr = array();   
    foreach($_POST["MCBands"] as $key => $val) {
        $arr[] = array(
            "MCBands" => $_POST["MCBands"][$key],
            "Yevaluation" => $_POST["Yevaluation"][$key],
            "Mevaluation" => $_POST["Mevaluation"][$key],
            "Cevaluation" => $_POST["Cevaluation"][$key],
            "Kevaluation" => $_POST["Kevaluation"][$key],
            "comment" => $_POST["comment"][$key]
        );    //semicolon added here ~M
    }

} 
+1

Source: https://habr.com/ru/post/1539970/


All Articles