title: PHP-page and HTML-form submits look so messy, how to avoid submits to SELF?
body: <p>I have a classifieds webbsite, and users have the option to change / remove their classifieds.</p>
  
  <p>I am working on a "edit.php" page where all this can be done.</p>
  
  <p>Basically it is setup like this when you click on "edit/remove classified":</p>
  
  <p>A new page appears, with a form, where user may chose from "REMOVE" and "CHANGE" through radios. The user must enter a password which is connected to the classified. Then they hit submit.</p>
  
  <p>The Form is submitted to itself, and checks which radio is selected, and checks if password was correct.</p>
  
  <p>If the password is wrong, then the same page appears again, but with a message saying, "wrong password".</p>
  
  <p>If the password is right, then based on if the user wants to "REMOVE" or "CHANGE" the classified, I want a completely new page to open.</p>
  
  <p>My question is, would it be possible ans secure to open a new page based on the radio selection, via php?</p>
  
  <p>Otherwise I would have to put so many if/else statements into the HTML and showing different forms with different actions, that it would be so messy.</p>
  
  <p>So in PHP I would like to do this:</p>
  
  <pre><code>&lt;?php
    if($password==$row['pass']){
      if($action == "remove"){ Open new page and DO remove }
      else if ($action == "change"){ Open new page and change the classified }
    }
  ?&gt;
  </code></pre>
  
  <p>I use session for storing variables.</p>
  
  <p>Is it possible, and secure to open a new page and just remove the classified for example? Or would it be safer to have multiple forms and display them based on the php form selections and password errors?</p>
  
  <p>Hard to explain, but I want simply to avoid alot of if/else in my HTML. Otherwise it would be something like:</p>
  
  <pre><code> &lt;body&gt;
     &lt;?php if($pass_wrong==1): ?&gt;
       FORM COMES HERE, AND STATES PASSWORD WAS WRONG
     &lt;?php endif; ?&gt;
  
     &lt;?php if($action=='remove' &amp;&amp; $pass_wrong==0): ?&gt;
       CLASSIFIED SUCCESSFULLY REMOVED
     &lt;?php endif; ?&gt;
  
     &lt;?php if($action=='change' &amp;&amp; $pass_wrong==0): ?&gt;
       Show a huuuuuge form to change the classified
     &lt;?php endif; ?&gt;
  
     ETC ETC
  </code></pre>