|
|
@@ -0,0 +1,33 @@
|
|
|
+<?php
|
|
|
+ // Here we can set the <title> of the page. Since we actually render the "main content" (i.e. this file here)
|
|
|
+ // before we execute the wrapper HTML template (src/templates/html.php), we can define the value here and it
|
|
|
+ // can be used in the wrapper code.
|
|
|
+ $context->title = "Page With Form";
|
|
|
+?>
|
|
|
+<!-- Wome actual HTML content -->
|
|
|
+<h1>Please enter some stuff</h1>
|
|
|
+<!--
|
|
|
+ We can also use other, smaller "templates" to build up our page. Here, we just load the navigation snippet
|
|
|
+ that we can see in src/templates/navigation.
|
|
|
+-->
|
|
|
+<?= $context->template("navigation") ?>
|
|
|
+
|
|
|
+<form action="/form" method="POST">
|
|
|
+ <label for="fname">First name:</label><br>
|
|
|
+ <input type="text" id="fname" name="fname" value="John"><br>
|
|
|
+ <label for="lname">Last name:</label><br>
|
|
|
+ <input type="text" id="lname" name="lname" value="Doe"><br><br>
|
|
|
+ <input type="submit" value="Submit">
|
|
|
+</form>
|
|
|
+
|
|
|
+<p>If you click the "Submit" button, the form-data will be posted back to this same page.</p>
|
|
|
+
|
|
|
+<?php
|
|
|
+ if ($_POST)
|
|
|
+ {
|
|
|
+ print "<p>You just POST-ed data to this page</p>";
|
|
|
+ print "<pre>";
|
|
|
+ var_dump($_POST);
|
|
|
+ print "</pre>";
|
|
|
+ }
|
|
|
+?>
|