Jump to content

Dropdown result in textfile


geldd001

Recommended Posts

Hello,

 

I wrote a small exportscript for data. One of the values I have to export is called valuta. The export will result in an export of only the value: array.

It is a dropdown menu with predevined values. In the export I need the value.

 

My script:

 

$DataFile = "data.txt";
 
$valuta = $_POST['form']['Valuta'];
 
$fp = fopen($DataFile, 'w') or die('Could not open file!');  
fwrite($fp, "$valuta") or die('Could not write to file');  
fclose($fp);
 
Probable an easy one for someone not being a newbee with PHP?
 
Thanx in advance
Link to comment
https://forums.phpfreaks.com/topic/279353-dropdown-result-in-textfile/
Share on other sites

Form:

 

 

</tr>
<tr class="rsform-block rsform-block-valuta">
<td>Valuta (*)</td>
<td><select  name="form[Valuta][]"  id="Valuta"  class="rsform-select-box" ><option  value="Eur">Eur</option><option  value="USD">USD</option><option  value="GBP">GBP</option><option  value="CZK">CZK</option><option  value="DKK">DKK</option><option  value="SEK">SEK</option><option  value="NOK">NOK</option><option  value="CHF">CHF</option></select><div class="formClr"></div><span id="component2153" class="formNoError">Invalid Input</span></td>
<td></td>
</tr>
 
And Script:
 
$DataFile = "data.txt";
 
$valuta = $_POST['form']['Valuta'];
 
$fp = fopen($DataFile, 'w') or die('Could not open file!');  
fwrite($fp, "$valuta") or die('Could not write to file');  
fclose($fp);
 
Other values are displayed correctly but I won't succeed in displaying the choosen option value.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.