I have a javaScript function that produces a value and inputs it into a span element. I now want to input this value (along with other values that the user has input) into my database using PHP however I seem to be unable to pull the value from the span. I was wondering if anyone could tell me where im going wrong or how I would go about this? Thanks

The javascript function:

```
    function updateTotalDistance() {
   var total = 0;
   $(".distance").each(function(){
       if(!isNaN(this.value) && this.value.length != 0) {
           total += Math.round(parseFloat(this.value));
       }
   });
   $("#totalDistance").text(total);
};

```

The span element:

```
<strong>Total Distance</strong><span id="totalDistance"</span>

```

my form:

```
<script type="text/javascript">
function SubmitAll(params) {
    var form = [ '<form method="POST" action="createclaim_process.php">' ];

    form.push('<input type="hidden" name="manager" value="<? echo $manager; ?>', document.getElementById("manager").value, '"/>');
    form.push('<input type="hidden" name="totalDistance" value="<? echo $totalDistance; ?>', document.getElementById("totalDistance").value, '"/>'); form.push('</form>');
    jQuery(form.join('')).appendTo('body')[0].submit();
}

```