I am trying to find out and track what browser and if a proxy is being used when I receive form submissions. I have the following code below:
<?php
$browser = $_SERVER['HTTP_USER_AGENT'];
$ip_address = $_SERVER['REMOTE_ADDR'];
if (array_key_exists('HTTP_X_FORWARDED_FOR', $_SERVER)) {
$ip_address = array_pop(explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']));
}
?>
For example I tried the below but it does not work. It is not submitting any data with my form.
What am I doing wrong?
echo ('<input type="hidden" name="browser" value="' . $browser . '" />' );
echo '<input type="hidden" name="browser" value="'.$browser.'">'
What am I doing wrong?
$
Try printf
printf('<input type="hidden" name="browser" value="%s">', $browser);
试试这个
echo ("<input type='hidden' name='browser' value='".$browser."'");
echo ('<input type="hidden" name="browser" value="'.$browser.'">');
试试this -> value="'.$browser.'"
这样的东西
You are combining echo and print (which both do the same) into one call. For another thing, you haven't closed the input element HTML (notice the final greater than sign I've added):
echo ('<input type="hidden" name="browser" value="' . $browser . '" />' );
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.