note 89486 deleted from reserved.variables.post by danbrown
| From: | danbrown@php.net | Date: | Tue, 10 Mar 2009 16:56:28 +0000 |
| Subject: | note 89486 deleted from reserved.variables.post by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-151694@lists.php.net to get a copy of this message | ||
Note Submitter: fuhrysteve at gmail dot com
----
Note that the data type of POST data is always a string:
<?php
gettype($_POST['whatever']) === 'string'; // always TRUE if
$_POST['whatever'] contains data
// You may find it helpful for security reasons (to avoid possible SQL
// injection vulnerability, etc) to do something like this:
$id = (int)$_POST['id'];
orObject->addRecord(int)($_POST['id']);
$price = (float)$_POST['price']; // you get the idea...
// to avoid silly things like this:
$id = addslashes($_POST['id']);
Object->addRecord(addslashes($_POST['id']));
?>