I'm grabbing a number using jquery, from a piece of data in my html, as follows.
This is the html line.
echo "<p class = 'bold center remainingland' data-RemainingLandForFacilities = $RemainingLandForFacilities>Remaining Land For New Facilities : " . ($RemainingLandForFacilities) . "</p>";
I get the data using jquery with this...
var remainingland = $(this).closest('div').find('.remainingland').attr('data-RemainingLandForFacilities');
(after pressing a button, which is 'this'). This works correctly and an alert shows me the number.
I then post to my php script with the usual...
$.post('scripts/upgradefacility.php',
{
remainingland : remainingland
And I collect it with.
$RemainingLand = filter_input(INPUT_POST, 'remainingland', FILTER_SANITIZE_STRING);
At this point, I do have the number, but it's a string (as confirmed by gettype). But when I try to convert it to an integer with...
$RemainingLand = intval($RemainingLand);
I just get a blank. I should point out that I just copy/pasted all of this from previous variables which I'm passing, all of which come through correctly, so this is really odd. I can only assume that I've made some error that I can't spot or that I've been doing something wrong all along but I've somehow got away with it until now.