Validate that an IP address has been entered into a textfield
Posted on 2006-04-11
I have the following form which is taking in IP addresses:
<form name="form1" method="post" action="ban.php">
IP to ban:
<input name="ip" type="text" id="ip">
<input type="submit" name="Submit" value="Submit">
What I want to do is to validate that the input is an IP address and if not send back a popup to screen for the user. obviously an IP cant contain letters and must have the four dots between the numbers.
how is this done?