使用post方法PHP [closed]获取innerHTML值

I want to take the innerHTML value of a label element in a form with method post and show it to another PHP page. But i have only work with that with textboxes, as an example in a login form. Any ideas??

<div id="menu" class="menu">
        <label class="" ></label>
        <label id="minutes">00</label>
        <label>:</label>
        <label id="seconds">00</label>
        <label id="" style="margin-left: 30px"></label>
        <label id="accuracyLetter" style="position:relative;">100%</label>
        <label id="" style="margin-left: 30px"></label>
        <label id="totalAccuracy">100%</label>
   </div>

You will need to use a hidden input:

<input type="hidden" name="label-value" value="innerHTML"/>

This will add label-value to the post hash.

W3Schools

Just use like this after label

<input type='hidden' name='postname' value='labelvalue'/>

In php

<?php
$labelname = $_POST['postname'];
echo $labelname;
?>

that's it !

Do you want to post "Some Name" to your php script?

<form action="script.php">
    <label for="name">
        Some Name
    </label>

    <input id="name" name="name">
</form>

If so you will need to add it as a hidden input:

Option 1: Using javascript

<script>
    $(function() {
        $('form').on('submit', function () {
            var labelText = $(this).find('label').text();
            $(this).append('<input type="hidden" name="label-text" value="' + labelText + '">');
        });
    });
</script>

Option 2:

Echo it together with the input field in your php.

<label>Some text</label>
<input type="hidden" name="label-text" value="Some text">