Hi all! A really quick question. I want to pass the IP address of anyone who submits a form to me on my site through a hidden field. I can then easiliy take action and block the spammers very easily. Question is how do I capture the IP and stick it in the form? THANKS!
well $ip=@$REMOTE_ADDR; echo "<input type='hidden' value='$ip' />"; This is the code and here is your IP address= 68.250.203.233 IP address if the register_global is off If at php.ini if register_global is set to Off then we have to change the script a bit to get the address. Here it is $ip=$_SERVER['REMOTE_ADDR'];
Thanks for the reply. I actually now have the code I need to capture the IP address. I call an ip cature function put the value in a variable called $ip. Now, I want to send it back to me in an email message along with the actual information sent to me by the user. Question is, my form is a here doc. I currently have my hidden input field setup like this: <input type="hidden" name="ipaddress" value='$ip'>. Which doesn't work.
Ok sorry, now I need to rephrase my request which is... How do I insert a variable INSIDE of a here doc? Example: <?php print<<<_FORM <input name="ipaddy" type="hidden" value="<?php echo $ip ?>"/> <textarea cols="40" rows="7" name="message"></textarea> <input name="submit" type="submit" value="Click to Send"/> _FORM; ?> The above example doesn't work.... the area in red needs help.