title: Php if Else in form action
body: <p>Im trying to make an online concert ticket system and this is my problem..</p>
  
  <pre><code>&lt;?php 
      if($tickettype == 'VIP'){
          $action = "seats.php"; 
      }else if($tickettype == 'VVIP'){
          $action ="seats1.php";
      }
  ?&gt;
  
  &lt;form action= "&lt;?php $action; ?&gt;" method="post"&gt;
  </code></pre>
  
  <p>And it doesn't work. Thank you in advance!</p>
  
  <p>heres the full codes for the particular file that has a problem.</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;Ariana Grande Concert&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;br&gt;
  &lt;table&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;img src="ariana2.jpg" height="300" width="260"&gt;&lt;/td&gt;
          &lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;
          &lt;td&gt;
              &lt;h2&gt;ARIANA GRANDE THE HONEYMOON TOUR&lt;/h2&gt;&lt;br&gt;
              &lt;font face="Lucida Sans Unicode"&gt; March 11, 2017&lt;br&gt;
              Grand Ballroom, Solaire Resort &amp; Casino&lt;br&gt;
              Due to peoples demand, Ariana Grande is back in the Philippines&lt;br&gt;
              Ariana Grande Live in the Philippines on &lt;b&gt; March 11, 2017!&lt;/b&gt;&lt;/font&gt;
              &lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;
          &lt;/td&gt;
      &lt;/tr&gt;
  &lt;/table&gt;
  
  &lt;br&gt;&lt;br&gt;
  &lt;hr&gt;
  &lt;br&gt;
  &lt;center&gt;
  
      &lt;table cellspacing="10" cellpadding="10" bgcolor="gray"&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;font face=""&gt;&lt;b&gt;TICKET PRICES:&lt;/b&gt;&lt;/font&gt;&lt;/td&gt;
  
              &lt;td&gt;&lt;b&gt;VVIP:&lt;/b&gt; &lt;u&gt;Php 25,000.00&lt;/u&gt;&lt;/td&gt;
              &lt;td&gt;&lt;b&gt;VIP:&lt;/b&gt; &lt;u&gt;Php 20,000.00&lt;/u&gt;&lt;/td&gt;
              &lt;td&gt;&lt;b&gt;Upper Box A:&lt;/b&gt; &lt;u&gt;Php 15,000.00&lt;/u&gt;&lt;/td&gt;
              &lt;td&gt;&lt;b&gt;Upper Box B:&lt;/b&gt; &lt;u&gt;Php 15,000.00&lt;/u&gt;&lt;/td&gt;
              &lt;td&gt;&lt;b&gt;Lower Box A:&lt;/b&gt; &lt;u&gt;Php 10,000.00&lt;/u&gt;&lt;/td&gt;
              &lt;td&gt;&lt;b&gt;Lower Box B:&lt;/b&gt; &lt;u&gt;Php 10,000.00&lt;/u&gt;&lt;/td&gt;
              &lt;td&gt;&lt;b&gt;General Ad:&lt;/b&gt; &lt;u&gt;Php 5,000.00&lt;/u&gt;&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/table&gt;
  &lt;/center&gt;
  
  &lt;br&gt;&lt;br&gt;
  
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font face="Lucida Sans Unicode" size="2"&gt;&lt;b&gt;Ticket Type:&amp;nbsp;&amp;nbsp;&lt;/b&gt;&lt;/font&gt;
  &lt;?php
      $TicketType = array('VIP' =&gt;'VIP', 'VVIP' =&gt;'VVIP', 'Upper Box A'=&gt;'Upper Box A', 'Upper Box B'=&gt;'Upper Box B', 'Lower Box A'=&gt;'Lower Box A', 'Lower Box B'=&gt;'Lower Box B', 'General Admission'=&gt;'General Admission') ;
  
      echo ' &lt;select name="Ticket_Type"&gt;';
      foreach ($TicketType  as $key =&gt; $value) {
          echo "&lt;option value=\"$key\"&gt;$value&lt;/option&gt;";
      }
      echo '&lt;/select&gt;';
  
  if($TicketType == 'VIP'){
      $action = "index.php";
  }else if ($TicketType == 'VVIP') {
      $action = "seats.php";
  }
  
      echo '&lt;font face="Lucida Sans Unicode" size="2"&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;Quantity:&amp;nbsp;&amp;nbsp;&lt;/b&gt;&lt;/font&gt;';
  
      $Quantity = range (1, 30);
      echo '&lt;select name="Quantity"&gt;';
      foreach ($Quantity  as $value) {
          echo "&lt;option value=\"$value\"&gt;$value&lt;/option&gt;\n";
      }
  echo '&lt;/select&gt;';
  
  
  
  ?&gt;
  
  &lt;form action="&lt;?php echo $action; ?&gt;" method="post"&gt;
  &lt;br&gt;&lt;br&gt;&lt;br&gt;
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;button class="btnExample" type="submit" value="Submit"/&gt;Next&lt;/button&gt;
  
  &lt;style&gt;
      .btnExample {
      color: #0000;
      background: white;
      font-weight: bold;
      border: 1px solid #0000;
      border-radius: 10px 10px 10px;
      }
  &lt;/style&gt;
  &lt;/form&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Heres the full codes of the webpage that has a problem. </p>