title: PHP calculation from html form
body: <p>I have created a reservations page for a restaurant website, with a form present to book a dinner reservation. It contains a dropdown box which allows the user to select the amount of people who will be dining in their party. It also contains a radio button to allow the user to select if they wish to be seated in the VIP area (Yes/ No).</p>
  
  <p>Each person in the party should cost an extra £5 towards their booking fee and if they wish to be seated in the VIP area, they will be charged an additional £5. Once the form validation is successful, the user will be sent to a confirmation page, where the reservation details they have entered, will be displayed to them.</p>
  
  <p>Currently I have a calculation present on the confirmation page of my website, which correctly calculates the party size costs, but my issue is that even if VIP area selection is "No", it is still adding on the £5 fee as if the user has selected "Yes".</p>
  
  <p>Here is the relevant html code on my reservations page:</p>
  
  <pre><code>&lt;?php
   session_start();
   if (isset($_POST['submit'])) { 
      $_SESSION['party'] = $_POST['party'];
  }
  
   if ( !empty($_POST['vip'])) 
      $_SESSION['vip'] = $_POST['vip'];
  ?&gt;
  
  ...
  
   &lt;strong&gt;Select Party Size* :&lt;/strong&gt;
   &lt;br&gt;
   &lt;select name="party" id="party" value="&lt;?php echo $party;?&gt;"&gt;
   &lt;option value=""&gt;Please Select&lt;/option&gt;
   &lt;option &lt;?php if (isset($party) &amp;&amp; $party=="1") echo "selected";?&gt; value="1"&gt;1 Person (+£5)&lt;/option&gt;
   &lt;option &lt;?php if (isset($party) &amp;&amp; $party=="2") echo "selected";?&gt; value="2"&gt;2 People (+£10)&lt;/option&gt;
   &lt;option &lt;?php if (isset($party) &amp;&amp; $party=="3") echo "selected";?&gt; value="3"&gt;3 People (+£15)&lt;/option&gt;
   &lt;option &lt;?php if (isset($party) &amp;&amp; $party=="4") echo "selected";?&gt; value="4"&gt;4 People (+£20)&lt;/option&gt;
   &lt;option &lt;?php if (isset($party) &amp;&amp; $party=="5") echo "selected";?&gt; value="5"&gt;5 People (+£25)&lt;/option&gt;
   &lt;option &lt;?php if (isset($party) &amp;&amp; $party=="6") echo "selected";?&gt; value="6"&gt;6 People (+£30)&lt;/option&gt;
   &lt;option &lt;?php if (isset($party) &amp;&amp; $party=="7") echo "selected";?&gt; value="7"&gt;7 People (+£35)&lt;/option&gt;
   &lt;option &lt;?php if (isset($party) &amp;&amp; $party=="8") echo "selected";?&gt; value="8"&gt;8 People (+£40)&lt;/option&gt;
   &lt;option &lt;?php if (isset($party) &amp;&amp; $party=="9") echo "selected";?&gt; value="9"&gt;9 People (+£45)&lt;/option&gt;
   &lt;option &lt;?php if (isset($party) &amp;&amp; $party=="10") echo "selected";?&gt; value="10"&gt;10+ People (+£50)&lt;/option&gt;
   &lt;/select&gt;
  
   &lt;strong&gt; VIP area* : &lt;/strong&gt; &lt;br&gt;&lt;br&gt;
   Yes (+£5) &lt;input type="radio" name="vip" &lt;?php if (isset($vip) &amp;&amp; $vip=="Yes") echo "checked";?&gt; value="Yes"&gt;
   &lt;br&gt;&lt;span id="vip" class="error"&gt;&lt;?php echo $vipErr;?&gt;&lt;/span&gt;&lt;br&gt;
   No &lt;input type="radio" name="vip" &lt;?php if (isset($vip) &amp;&amp; $vip=="No") echo "checked";?&gt; value="No"&gt;
  </code></pre>
  
  <p>Here is the relevant calculation on the confirmation page:</p>
  
  <pre><code>&lt;b&gt;Total Reservation Costs: &lt;/b&gt;&lt;br&gt;&lt;br&gt; £
  &lt;?php
       if (isset($_SESSION['party']) &amp;&amp; is_numeric($_SESSION['party'])) {
           $party = (int)$_SESSION['party'];
           $vip = isset($_SESSION['vip']) ? 5 : 0;
           echo (($party * 5) + $vip);
       }
  ?&gt;
  </code></pre>
  
  <p>Does anyone know how I can enable the calculation to only add the additional £5 for VIP area seating if the user has selected "Yes"? I am new to web languages so any help will be appreciated. Thank you!</p>