Forum Moderators: coopster
I have a form shown below:
<form name="form1" method="post" action="">
<label>URL Title
<input type="text" name="textfield">
</label>
<p>
<label>URL[starting with http://]
<input type="text" name="textfield2">
</label>
</p>
<p>
<label>Where to add?
<select name="select">
<option selected>pick one</option>
<option>a</option>
<option>b</option>
<option>c</option>
<option>d</option>
<option>e</option>
<option>f</option>
<option>g</option>
<option>h</option>
<option>i</option>
<option>j</option>
<option>k</option>
<option>l</option>
<option>m</option>
<option>n</option>
<option>o</option>
<option>p</option>
<option>q</option>
<option>r</option>
<option>s</option>
<option>t</option>
<option>u</option>
<option>v</option>
<option>w</option>
<option>x</option>
<option>y</option>
<option>z</option>
</select>
</label>
</p>
<p>
<label>
<input type="submit" name="Submit" value="Add a link">
</label>
</p>
</form>
I would like to know if there is way I can make this form work that way that when I everything is selected and I click submit button, it will write the data in certain way in a particular .txt file, and the way the particular file will be selected is from the pulldown menu.
Thank you,
fast4u
$myFile = $_REQUEST['select']; // selected dropdown value is the file name
$fh = fopen($myFile, 'w') or die("can't open file");
// now fetch each form variable and write it
fwrite($fh, $_REQUEST['form_field_name']."\n");
fclose($fh); //close the file after writing is completed