Q:

$_POST of a form showing null

I am using javascript and trying to call another function from  a function with passing arguments in $_POST variable of php ! I cant figure Why am I getting null every time.
Here's the code for the form in javascript
" To " +
        "<select name='to'>"; 
        //document.write(arr.length); 
        for(i=0; i<arr.length; i++)
        {
        if(arr[i])
        txt_bottom += "<option  value='" + arr[i] + "'>" + arr[i] + "</option>";    
        }
        txt_bottom+= "</select> <br> <br>" +

"Input : <input type='text' name='input_value' />
 <input type='submit' value='Evaluate'
 onclick=\"calculate_mesurement('<?php echo isset($_POST["from"])?$_POST["from"]:"nothing"?>', '<?php echo isset($_POST["to"])?>')\"/> <br><br>" +

To make the code clear this is just informative that calculate_measurement accepts two arguments
Any help will be highly appreciated

A:

Are you trying to run calculate_mesurement using the values the user just entered into from and to? $_POST isn't set until the form is submitted, you have to use Javascript to get form values prior to submitting.
onclick="calculate_mesurement(document.getElementsByName('from')[0].value, document.getElementsByName('to')[0].value)"

