Jump to content

Archived

This topic is now archived and is closed to further replies.

Reg Web

IP in forms

Recommended Posts

Is there a way you can fetch the IP address of a user, then add it into a hidden field on a form using a mysql table?

Share this post


Link to post
Share on other sites
[code]
<form name="myform">
<input type="hidden" name="myhiddenfield" value="<?php echo $_SERVER['REMOTE_ADDR']; ?>" />
</form>
[/code]

not sure why you'd need mysql at all to do this, but the above will create a hidden field with the user's IP address in it.

cheers
Mark

Share this post


Link to post
Share on other sites
IP address can be fetched from predefined variable $_SERVER['REMOTE_ADDR']

more on subject: [url=http://www.php.net/manual/en/reserved.variables.php#reserved.variables.server]http://www.php.net/manual/en/reserved.variables.php#reserved.variables.server[/url]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.