开发者

php debugging POST vars

开发者 https://www.devze.com 2023-02-10 05:35 出处:网络
This may be asking a lot, but I am looking for a way to detect the attributes in some of my form input fields.

This may be asking a lot, but I am looking for a way to detect the attributes in some of my form input fields.

For example:

<input type="text" name="fieldone" id="fieldone" value="me@me.com" />

I can simply use a php foreach loop to get the key => value information.

<?php
$querystring = "";
if ($_POST){  $kv = array();  
  foreach ($_POST as $key => $value){ $querystring .= "$key=$value<br>"; } 
}
?>

And this helps with mediocre debugging reasons.

However, this only detects the name and value of the fo开发者_运维问答rm field. How do I detect the "id" attribute, or any custom attributes I may add.

Is there a way to detect/display the attributes of POST variables? Or does php stop at the name/value?


Only Name and value are senet to the server. ID and other attributes are not sent at all (why would they).

BTW: You'll want to use print_r($_POST); or var_dump($_POST); instead of your loop.


Nothing except the name and value are sent over HTTP.

You'll need to use some JavaScript pre-processing for that.

For example, on form submit, you could use JavaScript to store all the attributes with the name, but this will be messy.


When a form is submitted, only the name and value fields are used. The other fields are only used client side (inside the browser) and not returned to the server.

0

精彩评论

暂无评论...
验证码 换一张
取 消