php将多选标签保存到文本文件中

I have 3 select tags inside a form :

    <form   id="transactions" method="POST">
        <select name="Markets">
          <option value="Asia_cnl">Asia</option>
          <option value="Europe_mct">Europe</option>
          <option value="America_sth">South America</option>
            ...etc  
        </select>

Selecting an option from "Markets" will populate the second slect tag "Circuits". Let's say the user selects option 'Asia':

        <select name="Circuits">
          <option value="SSyoung">SSyoung</option>
          <option value="Weytang">Weytang Corp.</option>
          <option value="Anushi">Anushi Media inc.</option>
            ...etc  
        </select>

Selecting an option from "Circuits" will load a last select tag "ActivePartners":

        <select name="ActivePartners">
          <option value="id_of_partner_1">Partner1</option>
          <option value="id_of_partner_2">Partner2<option>
          <option value="id_of_partner_3">Partner3</option>
            ...etc  
        </select>

        <input type="submit" name="submit" value="Update List"/>
        </form>

The user will delete some values in "ActivePartners" and must save the result to a text file as follow:

  • file content : all remaining options of "ActivePartners"
  • file name : (the selected text of "Circuits").txt
  • DIrectory : /path1/..etc/(the selected text of "Markets")

how can I handle this in php?

Black smoke is out of my head and I am gratefull to any answer to have an 'abemus script! :-)'

First change the form field name value. After submitting data it store in $_POST variable so you can track the data with $_POST['markets'], $_POST['circuits'], $_POST['activePartners'] then

$target_file = fopen("newfile.txt", "w") or die("Unable to open file!");
$txt = $_POST['markets']." ".$_POST['circuits']." ".$_POST['activePartners']."
";
fwrite($target_file , $txt);
fclose($target_file);