I am new to PHP and have a question about how to append information to a .txt
file using a form with a button with type="button"
, the appending should be ;
separated in the .txt
file. Can someone help me on how to accomplish the appending from the form to the .txt
file?
(Each time you fill out the form and append the information to the .txt
file a list-element should be created beside the form and containing only the information of the two first input-elements, taken from the .txt
file). The form looks like this:
<?php
include("header.php");
?>
<form id="info" method="post" action="">
<p id="formrubrik">Add information here:</p><br/>
<p>Title:</p>
<textarea class="field" id="title" name="names" rows="1" cols="20"></textarea><br/><br/>
<p>Grade</p>
<select class="field" name="grade" id="star">
<option value="0">Choose grade...</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
</select><br/><br/>
<p>Link:</p>
<textarea class="field" id="link" name="links" rows="1" cols="20"></textarea><br/><br/>
<p>Photo link:</p>
<textarea class="field" id="picture" name="photo" rows="1" cols="20"></textarea><br/><br/>
<p>Description:</p>
<textarea class="field" id="handling" name="description" rows="3" cols="20"></textarea><br/><br/>
<button value="0" id="add" type="submit">Save</button><br/>
</form>
<div id="list_elements">
<ul id="elements">
</ul>
</div>
<?php
include("footer.php");
?>