Nov 20, 2022

# Solution 1 :

<input type='number' class="form-control" name='ppdistance' id="ppdistance" placeholder="Pole to Pole distance in feets" required="required" min="0">

min=”0″ value and plz refresh browser and set it

# Problem :

How can we pass floating point values to another page? I have sent a floating point value in an AJAX request, but the page only received an integer value.

<div class="form-group">
<label for="" class="col-sm-4 control-label">Pole to Pole distance in feets <font color="red">*</font></label>
<div class="col-sm-6">
<input type='number' class="form-control" name='ppdistance' id="ppdistance" placeholder="Pole to Pole distance in feets" required="required" min="0">
</div>
</div>
<br>
<div class="form-group">
<label for="" class="col-sm-4 control-label">Number of Fencing line per Pole <font color="red">*</font></label>
<div class="col-sm-6">
<input type="number" class="form-control" name='fensing' id="fensing" placeholder="Number of Fencing line per pole " required="" step="0.01">
</div>
</div>
<br>
<div class="modal-footer">
<input type='button' id="myBtn" class="btn btn-default btn1" value="Submit">
</div>

function myFunction() {
let data = {
size: \$('[name="size"]').val(),
numpols: \$('[name="numpols"]').val(),
ppdistance: \$('[name="ppdistance"]').val(),
fensing: \$('[name="fensing"]').val()
}

\$.ajax({
type: "POST",
url: "joins.php", //"join.php"
dataType: "html",
data: data,
success: function(response) {
document.getElementById('demo').innerHTML = response;
},
error: function(error) {
}
});

Retrieve Page values can print integer values display

echo \$numpols;
echo '<br>';
echo \$ppdistance;
echo '<br>';
echo \$fensing;
echo '<br>';

echo \$ms = \$numpols * \$ppdistance * \$fensing;

The output I get looks like this:

670
7
78
365820

I am expecting my output to look like this:

670
7
7.8
36582

How can I fix this?
can u see the screen shot also

### Comment posted by Dharman

How is this related to MySQLi?

### Comment posted by Rory McCrossan

Nothing in your code would convert

### Comment posted by Tony Nagendra Kumar

i will cross check all aspects and they retrive 7.8 to 78 and single integer and doble inter working fine only floating values this problem occur

I agree, there’s nothing in this code which definitively reproduces the error, as far as I can see. Have you used your browser’s Developer Tools to see exactly what values AJAX is sending in the request? Have you tried to dump your PHP \$_POST values to see what is being received? Have you examined whatever PHP code comes between reading the POST values and assigning it to those variables (which isn’t shown in your sample above)? More debugging is needed (line by line, if necessary) to narrow down the precise point where the variables no longer contain the data you expected them to.

I see you’ve added a screenshot since I last commented, and that’s nice, but it doesn’t answer any of the questions I posed, or provide any of the information I mentioned. Please provide more of the relevant details and/or carry out the debugging I described, so you can get information which can help you to identify the exact problem. Right now, we still cannot help you due to lack of important details. More than likely, some proper debugging will allow you to identify and probably resolve the issue yourself. If you’re still stuck though, post the info here and we can look at it further.