PHP get input value without submit
<p>Guys i have foreach loop where i list some prices. All price have own input radio button.</p>

<p>By default only one price from looping is checked. I want to get that value when page is lodaed.</p>

<p>I have one session where i store number of days. Based on these days I get the price of cars.</p>

<pre><code>$numDays = $_SESSION['days']; // 5
$calculate_km = $numDays * 140;  // 5*140km
</code></pre>

<p>So in page where i want to show total KM i use:</p>

<pre><code>if(isset($_SESSION['days']) {
    $numDays = $_SESSION['days'];
}else {
    // Show default selected radio button value
}
</code></pre>

<p>Problem is bcs price list with <code>radio</code> is on the some page and there is no sumbiting</p>

<p><strong>My loop:</strong></p>

<pre><code>&lt;?php if($prices = getCarPricePeriod($car-&gt;ID, $od, $do)):?&gt;
    &lt;?php $first = true; ?&gt;
        &lt;?php foreach ($prices as $price): ?&gt;
            &lt;tr&gt;
                &lt;td&gt;&lt;input type="radio" name="price" value="&lt;?= $price['value'];?&gt;" &lt;?= $first ? 'checked' : '' ?&gt;&gt; &lt;/td&gt;
                &lt;td&gt;&lt;input type="text" name="price_name" value=" &lt;?= $price['name'];?&gt;"&gt;&amp;euro;/per day&lt;/td&gt;
            &lt;/tr&gt;
        &lt;?php endforeach; ?&gt;
    &lt;?php $first = false; ?&gt;
&lt;?php endif; ?&gt;

Total KM : &lt;span&gt; &lt;?= $numDays * 140 ;?&gt; &lt;/span&gt;
</code></pre>

<p>Only is posible to get that value if i submit that form. So i need <code>js</code> for this or any way to do this in <code>php</code></p>