Naresh Kumar Naresh Kumar - 2 years ago 63
HTML Question

form field with decimal value shows as empty in $_POST

I have a form field that looks like this:

<input type="hidden" name="last_amount_paid" value="<?php echo $amount; ?>">

$amount is set to 100.00 and shows up fine if I change the form field from hidden to text.

$_POST['last_amount_paid '] is empty when I try and retrieve the value after submit.

I ran var_dump($_POST); and it's showing up as a string and empty

["last_amount_paid"]=> string(0) ""

Any ideas?

Answer Source

So for me it works if I create a tiny script like this:

    echo $_POST["last_amount_paid"];
} else
    $amount = 100.00;
    <form method="POST" action="">
        <input type="hidden" name="last_amount_paid" value="<?=$amount; ?>" />
        <input type="submit" value="Submit" />

You can see it work here. Happy Copy & Pasting. :D

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download