Previous Page

Get a user's IP address



Click on the following link to try it out. Try me!



Below is the entire page with the html and php

<?php

   $ip_address = '';
   
    if($_POST['submit']== 'Get my IP address')
    {	
       $ip_address = $_SERVER['REMOTE_ADDR'];  
    }
    
?>


<p>Just click the button below<br />
                   
<form  action="" method="post">
	<input type="submit" name="submit" value="Get my IP address" />
</form>



<?php	
	echo 'Your IP address is: '.'<div>'.$ip_address.'</div>';			  		
?>