How to handle multiple actions using a single html form
<p>I hope I can be clear enough in what I need here. What I have is a function that contains some html for an email client app I'm developing. This part of the app uses a common forward, reply and "reply to all" form. Since they are all basically the same, I figured I'd go the lean route and just use a single function to handle this. The only real differences I can see between the 3 actions I mentioned above are that in a reply to all, there will be multiple email addys in the CC part of the form. For a forward, no (cc) and the (to) box should be blank. I need to represent all of this functionality and I'm kind of confused on what the best way to do this is. Can anyone please offer any help? Thanks.</p>

<p>I can certainly post the html is need be, I just wanted to start light.</p>

<p>EDIT:
I almost forgot, there will be POST values when the user submits the form in the event that the form validation fails.</p>

<p><hr /></p>

<pre><code>function compose($type,$contents=null)
{
    echo'
        &lt;tr&gt;
          &lt;td&gt;
            &lt;tr&gt;
              &lt;td valign="top"&gt;
                &lt;form method="post" action=""&gt;
                  &lt;table width="100%" cellpadding="0" cellspacing="0" border="0" id="reply"&gt;
                    &lt;tr&gt;
                      &lt;td&gt;&lt;h2&gt;'.$type.'&lt;/h2&gt;&lt;/td&gt;
                    &lt;/tr&gt;
                    &lt;tr&gt;
                      &lt;td width="1%" valign="top" nowrap&gt;&lt;b&gt;To:&lt;/b&gt;&lt;br&gt;&lt;input name="to" id="focus" title="Enter a single system user here" value="" type="text" size="64"&gt;&lt;/td&gt;
                    &lt;/tr&gt;
                    &lt;tr&gt;
                      &lt;td nowrap&gt;&lt;b&gt;Cc:&lt;/b&gt;&lt;br&gt;&lt;input name="cc"" value="" type="text" size="64"&gt;&lt;/td&gt;
                    &lt;/tr&gt;
                    &lt;tr&gt;
                      &lt;td nowrap&gt;&lt;b&gt;Subject:&lt;/b&gt;&lt;br&gt;&lt;input name="subject" title="Enter your subject here" value="" type="text" size="64" maxlength="30"&gt;&lt;/td&gt;
                    &lt;/tr&gt;
                    &lt;tr&gt;
                      &lt;td valign="top"&gt;&lt;b&gt;Message:&lt;/b&gt;&lt;br&gt;&lt;textarea name="message" title="Enter your message here" rows="5" cols="50" wrap="virtual"&gt;&lt;/textarea&gt;&lt;/td&gt;
                    &lt;/tr&gt;
                    &lt;tr&gt;
                      &lt;td&gt;&amp;nbsp;&lt;/td&gt;
                    &lt;/tr&gt;
                    &lt;tr&gt;
                      &lt;td&gt;&lt;input type="hidden" name="id" value=""&gt;&lt;input type="submit" name="send" value="Send"&gt;&lt;/td&gt;
                    &lt;/tr&gt;
                  &lt;/table&gt;
                &lt;/form&gt;
              &lt;/td&gt;
            &lt;/tr&gt;
          &lt;/td&gt;
        &lt;/tr&gt;';
}
</code></pre>
