Posted by Erwin Moller on 05/16/07 18:17
jmark@fastermail.com wrote:
> I have seen some code like
> $value = strval($REQUEST['value']);
>
> I would like to know what is the use of strval here since $_REQUEST
> values are strings?
Hi,
$_REQUEST values might as well contain arrays.
Consider this form:
<form action="test.php" Method="POST">
<input type="checkbox" name="bla[]" value="1">1<br>
<input type="checkbox" name="bla[]" value="2">2<br>
<input type="checkbox" name="bla[]" value="3">3<br>
</form>
When receiving $_POST["bla"] it contains an array.
The programmer wanted to make sure it is a string.
Regards,
Erwin Moller
PS: I think you should avoid $_REQUEST. Just use $_POST and $_GET.
[Back to original message]
|