I am trying to add some text from my html form with 4 inputs. I may have been staring myself blind at this, but I can't figure out where it fails.
Ihave tried with "a" instead of doing the "r" and then "w" option.
$fuldenavn = $_POST["navn"];
$voksneantal = $_POST["voksne"];
$bornantal = $_POST["born"];
$kontaktinfo = $_POST["contacts"];
$content = $fuldenavn. PHP_EOL .$voksneantal. PHP_EOL .$bornantal. PHP_EOL .$kontaktinfo.;
$file = fopen("tilmeldinger.txt", "r");
$old_content = fread($file, filesize('tilmeldinger.txt'));
fclose($file);
$file = fopen('tilmeldinger.txt', 'w');
fwrite($file, $content."\n".$old_content);
fclose($file);
echo "Din tilmelding er modtaget. Tak! :)";
I have had two different outcomes, either blank page or error 500.
html form:
<form method="post" action="tilmeld_noc.php">
Fulde navn: <input type="text" name="navn"></tab>
Antal Voksne: <input type="text" name="voksne" value="0">
Antal u. 12: <input type="text" name="born" value="0">
E-mail el. tlf.: <input type="text" name="contacts" value="0"><br>
<input type="submit" id='tilmeldbutton' value="Send Tilmelding" />
</form>