在php标签内编写表单数据的正确方法

what i hoped to achieve is to echo each data as they come out from sql with checkboxes by theur side but it just ignores the form data inside the php

<form action = "index.php" method = "post">
<input type = "checkbox" name = "kona"/>
<?php
echo  $selcat . "<br>";

if (isset ( $price_data )) {
    $price_query = "SELECT * FROM titem WHERE comment = '$price_data'";
    $price_result = mysql_query ( $price_query, $connection );
    if (! $price_result) {
        echo 'no' . mysql_error ();
    }
    while ( $price_row = mysql_fetch_array ( $price_result ) ) {

        echo  "<h3>" .  $price_row['item'] . "</h3><br>";
            echo "<input type = checkbox name = selitem" . $selitem . "/><br>";
        echo 'Price = ';
        if (is_numeric ( $price_row ['price'] )) {
            echo $price_row ['price'] . " naira" . "<br>";
        } else {
            echo $price_row ['price'] . "<br>";
        }
    }
} else {
    echo '';
}
?>          
</form>

Any ideas as to how i can make this work?

You're outputting two tags mixed up together, like this:

<input type =checkbox name =selitem<h3>...</h3><br> />

Perhaps you meant to do:

echo '<input type="checkbox" name="selitem" /><h3>' . $price_row['item'] . '</h3><br />';

This would output:

<input type="checkbox" name="selitem" /><h3>...</h3><br />

Why are you concat 2 strings without PHP varaibles between that?

echo  "<input type =" . "checkbox" . " name =" . "selitem" . "<h3>" .  $price_row['item'] . "</h3><br>" . "/>";

It should be:

echo  "<input type=\"checkbox\" name=\"selitem\"<h3>. $price_row['item']. "</h3><br> />";

You have to use array for name:

echo  "<input type=\"checkbox\" name=\"selitem[]\"<h3>. $price_row['item']. "</h3><br> />";

And in PHP you can loop foreach on $_POST['selitem'] array - each element is checked element.