Jump to content


Photo

IP in forms


  • Please log in to reply
2 replies to this topic

#1 Reg Web

Reg Web
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 22 October 2006 - 01:34 PM

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?

#2 redbullmarky

redbullmarky
  • Staff Alumni
  • Advanced Member
  • 2,863 posts
  • LocationBedfordshire, England

Posted 22 October 2006 - 01:44 PM

<form name="myform">
<input type="hidden" name="myhiddenfield" value="<?php echo $_SERVER['REMOTE_ADDR']; ?>" />
</form>

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
"you have to keep pissing in the wind to learn how to keep your shoes dry..."

I say old chap, that is rather amusing!

#3 LazyJones

LazyJones
  • Members
  • PipPipPip
  • Advanced Member
  • 78 posts

Posted 22 October 2006 - 01:45 PM

IP address can be fetched from predefined variable $_SERVER['REMOTE_ADDR']

more on subject: http://www.php.net/m...ariables.server




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users