This is the form:
<form role="form" action="<?php echo $action; ?>" name="send_request" method="post" onsubmit="calcDist();" id="send_request">
<div class="content">
<div class="form-group">
<input type="text" id="input-from" class="form-control" name="from" placeholder="<?php echo $entry_from; ?>" />
<input type="text" id="input-to" class="form-control" name="to" placeholder="<?php echo $entry_to; ?>" />
<input type="hidden" class="form-control" name="kmdist" value="">
</div>
<input type="submit" value="<?php echo $button_send; ?>" class="btn btn-default" />
</div>
</form>
I'm computing the distance in calcDist(); between the given cities from the text inputs on submit and save the cities to the database through the form action, but I don't know how to add that distance variable to the post data array before the actual saving action.
enctype="multipart/form-data"when not uploading files.