PHP如何通过$ _POST获取输入值类型

Hi I am sending a form through post to a php file that I have made. I have been able to use $_POST["name"] to get the vales of input fields of type text/password,/etc but now I would like to also get their 'type'. So in my variable $car = $_POST["car"]; will store the value, I would like $carInputType to store the inputs type. So if in the form the person chose Mazda in a checkbox, I would like the $carInputType to hold 'checkbox' the type.

I hope I explained this well I think this could be useful for many people to learn. I have been looking around but I have not found ANYTHING to answer this. I have tried:

$radio = $_POST["fname[type]"];
$radio = $_POST["fname[type=]"];

A bit of my form is as follows:

<form id="ajax-form" onsubmit="return false;">
<div><label for="uname">Username <em>*</em></label> <input id="uname"     type="text" name="uname" value=""  /><p class='note' id = "userNameID"></p>        </div>
</form>

Any help would be greatly appreciated. Thank you for reviewing my post.

You can't do this with only PHP. You would use JavaScript or jquery to build the post data as you need it.

var data =    $('#myForm').serializeArray();    
data.push({
    name: 'elementName', 
    value: 'elementValue',
    Type: 'element type'
}); 
$.post("page.php", data);