php - Accessing POST data -
i'm new php have understanding of c,
when want access post data on api i'm creating in php use:
$_post['date_set']
to fetch value being passed date - works perfectly, read should fetching this:
$date_set = trim(urldecode($_post['date_set']));
this returns 00:00:00 value date after it's stored in db.
when access directly using $_post['date_set'] whatever value posted, example: 2013-08-28 10:31:03
can tell me i'm messing up?
you run urldecode
on data url encoded. php have decoded before populating $_post
, shouldn't using that. (you might have if dealing double-encoded data, right solution there should not double encode data).
trim
removes leading , trailing white-space. useful if have free form input in rogue spaces might typed. need further sanity checking afterwards.
Comments
Post a Comment