geldd001 Posted June 19, 2013 Share Posted June 19, 2013 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 More sharing options...
litebearer Posted June 19, 2013 Share Posted June 19, 2013 1. what error are you receiving? 2. have you tried echoing $valuta? Link to comment https://forums.phpfreaks.com/topic/279353-dropdown-result-in-textfile/#findComment-1436831 Share on other sites More sharing options...
geldd001 Posted June 19, 2013 Author Share Posted June 19, 2013 1. I don't receive an error 2 The result when i am using Echo is "Array" Link to comment https://forums.phpfreaks.com/topic/279353-dropdown-result-in-textfile/#findComment-1436832 Share on other sites More sharing options...
litebearer Posted June 19, 2013 Share Posted June 19, 2013 Show us your form and your full script Link to comment https://forums.phpfreaks.com/topic/279353-dropdown-result-in-textfile/#findComment-1436836 Share on other sites More sharing options...
geldd001 Posted June 19, 2013 Author Share Posted June 19, 2013 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. Link to comment https://forums.phpfreaks.com/topic/279353-dropdown-result-in-textfile/#findComment-1436839 Share on other sites More sharing options...
Barand Posted June 19, 2013 Share Posted June 19, 2013 Why such a complex name for the select? Instead of <select name='valuta' ... > Then access it with $_POST['valuta'] Link to comment https://forums.phpfreaks.com/topic/279353-dropdown-result-in-textfile/#findComment-1436852 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.