i am trying to validate a url that the user inputs in a form using php's fsocketopen() inside a javascript function. my problem is how can php identify the passed value to the javascript function, here e. does anybody know?
heres my function:
function checkUrl(field)
{
var e = field.value;
<?
$found = fsockopen($e, 80, &$errno, &$errstr, 30);
if (!$found)
echo "alert('invalid url');return false";
?>
}
return true;
}
i call this function using:
echo "<form method=post action=$PHP_SELF?action=51 onSubmit=\"return checkUrl(this.url));\" >";
echo "<input type=text size=50 maxlength=50 name=url><BR>";
echo "<input type=submit name=submit><BR>";
echo "</form>";