I'm trying to get the user's ip address once the page loads with the following:
<?php
$user_ip = $_SERVER['REMOTE_ADDR'];
?>
and trying to print the value like so:
<input id="ip" name="ip" value="<?php $user_ip = echo ($user_ip); ?>" type="hidden">
for some reason it won't print. Any ideas?
If you assign the echo result, it will print nothing :
<input id="ip" name="ip" value="<?php echo ($user_ip); ?>" type="hidden">
If you want to display it to user :
<input id="ip" name="ip" value="<?php echo ($user_ip); ?>" type="text">
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.