PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
tomindo
Forum Newbie
Posts: 13 Joined: Sun Mar 21, 2010 1:22 am
Post
by tomindo » Wed Dec 15, 2010 1:38 am
it does not echo the ip conversions. I tried without ip2long functino , it worked fine
Code: Select all
<form method="post" action="test.php">
<textarea name="new" cols="40" rows="10">
samplehost-1,127.0.0.1
samplehost-2,127.0.0.2
</textarea><br>
<input type="submit" value="Add Servers">
</form>
<?phpif(isset($_POST['new'])) {
$array= explode("\n",$_POST['new']);
foreach ($array as $ni) {
$array=explode(',', $ni);
echo ip2long($array[1]);
}
}
?>
Darhazer
DevNet Resident
Posts: 1011 Joined: Thu May 14, 2009 3:00 pm
Location: HellCity, Bulgaria
Post
by Darhazer » Wed Dec 15, 2010 1:57 am
most likely, ip2long returns false, and this is why echo does not work
you can use var_dump() to check
The same way check the value of $array[1]
tomindo
Forum Newbie
Posts: 13 Joined: Sun Mar 21, 2010 1:22 am
Post
by tomindo » Wed Dec 15, 2010 9:34 am
thanks