<form method='post' action="#">
<div class="form-group">
<label for="title">Title</label>
<input type="text"
class="form-control"
id="title"
placeholder="Enter a title"
name="title">
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
Iets ingekort zodat het leesbaar blijft.
Het action=“#” attribuut stuurt de inhoud van de input tags terug naar deze pagina. Dat is wat ik vind op internet. Maar ook wordt op een magische manier een method aangeroepen die de database update! Hoe gebeurt dat?
Op SO lees ik dit:
The # tag lets you send your data to the same file. I see it as a three step process:
Query a DB to populate a from
Allow the user to change data in the form
Resubmit the data to the DB via the php script
With the method='#' you can do all of this in the same file.
After the submit query is executed the page will reload with the updated data from the DB. Dat is precies wat er gebeurt: maar Hoe werkt dat, c.q. hoe kan het werken?
In punt 3: wat is the php script? Hoe kan het “systeem” weten welk php script te gebruiken?