POST
This commit is contained in:
+16
-2
@@ -1,6 +1,6 @@
|
||||
|
||||
|
||||
RENDER()
|
||||
void show_stuff()
|
||||
{
|
||||
//context->header["Content-Type"] = "text/plain";
|
||||
//echo(to_string(time())+"\n");
|
||||
@@ -8,7 +8,7 @@ RENDER()
|
||||
<html>
|
||||
Mwahahaaha <?= time() ?>
|
||||
<div>hello world: <?= context->params["HTTP_HOST"] ?></div>
|
||||
<pre style="background:rgba(0,0,0,0.1);max-height: 200px; overflow: auto;">
|
||||
<pre>
|
||||
Display the date using any or all of the following elements:
|
||||
|
||||
%a: abbreviated day name (i.e. mon, tue, wed)
|
||||
@@ -174,3 +174,17 @@ Lifewire is part of the Dotdash publishing family.
|
||||
|
||||
}
|
||||
|
||||
RENDER()
|
||||
{
|
||||
|
||||
<html>
|
||||
<link rel="stylesheet" href='style.css?v=1'></link>
|
||||
<h1>
|
||||
<a href="index.uce">UCE Test</a>:
|
||||
Index
|
||||
</h1>
|
||||
<? show_stuff(); ?>
|
||||
<pre><?= var_dump(context->params) ?></pre>
|
||||
</html>
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
|
||||
|
||||
RENDER()
|
||||
{
|
||||
|
||||
<html>
|
||||
<link rel="stylesheet" href='style.css?v=1'></link>
|
||||
<h1>
|
||||
<a href="index.uce">UCE Test</a>:
|
||||
Index
|
||||
</h1>
|
||||
<ul>
|
||||
<li><a href="hello.uce">Hello</a></li>
|
||||
<li><a href="post.uce">Form Post</a></li>
|
||||
<li><a href="post-multipart.uce">Form Multipart Post</a></li>
|
||||
</ul>
|
||||
<pre><?= var_dump(context->params) ?></pre>
|
||||
</html>
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
|
||||
void show_form()
|
||||
{
|
||||
|
||||
<form action="?" method="post" enctype="multipart/form-data">
|
||||
<div>
|
||||
<label>Some text:</label>
|
||||
<input type="text" name="fühld" value="<?= context->post["fühld"] ?>"/>
|
||||
</div>
|
||||
<div>
|
||||
<label>Some multiline text:</label>
|
||||
<textarea name="field2"><?= context->post["field2"] ?></textarea>
|
||||
</div>
|
||||
<div>
|
||||
<input type="submit" value="Submit Form"/>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
}
|
||||
|
||||
RENDER()
|
||||
{
|
||||
|
||||
<>
|
||||
<link rel="stylesheet" href='style.css?v=1'></link>
|
||||
<h1>
|
||||
<a href="index.uce">UCE Test</a>:
|
||||
Multipart-Encoded Form POST
|
||||
</h1>
|
||||
|
||||
<? show_form(); ?>
|
||||
|
||||
<div>
|
||||
|
||||
</div>
|
||||
|
||||
<label>Parsed POST fields</label>
|
||||
<pre><?= var_dump(context->post) ?></pre>
|
||||
|
||||
<label>Raw POST content</label>
|
||||
<pre><?= context->in ?></pre>
|
||||
|
||||
<label>CGI Params</label>
|
||||
<pre><?= var_dump(context->params) ?></pre>
|
||||
</>
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
|
||||
void show_form()
|
||||
{
|
||||
|
||||
<form action="?" method="post">
|
||||
<div>
|
||||
<label>Some text:</label>
|
||||
<input type="text" name="field" value="<?= context->post["field"] ?>"/>
|
||||
</div>
|
||||
<div>
|
||||
<label>Some multiline text:</label>
|
||||
<textarea name="field2"><?= context->post["field2"] ?></textarea>
|
||||
</div>
|
||||
<div>
|
||||
<input type="submit" value="Submit Form"/>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
}
|
||||
|
||||
RENDER()
|
||||
{
|
||||
|
||||
<html>
|
||||
<link rel="stylesheet" href='style.css?v=1'></link>
|
||||
<h1>
|
||||
<a href="index.uce">UCE Test</a>:
|
||||
Form POST
|
||||
</h1>
|
||||
|
||||
<? show_form(); ?>
|
||||
|
||||
<label>Parsed POST fields</label>
|
||||
<pre><?= var_dump(context->post) ?></pre>
|
||||
|
||||
<label>Raw POST content</label>
|
||||
<pre><?= context->in ?></pre>
|
||||
|
||||
<label>CGI Params</label>
|
||||
<pre><?= var_dump(context->params) ?></pre>
|
||||
</html>
|
||||
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
* {
|
||||
font-family: inherit;
|
||||
font-size: inherit;
|
||||
box-sizing: inherit;
|
||||
color: inherit;
|
||||
line-height: inherit;
|
||||
}
|
||||
|
||||
a {
|
||||
color: yellow;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 200%;
|
||||
padding-top: 8px;
|
||||
padding-bottom: 8px;
|
||||
}
|
||||
|
||||
body {
|
||||
max-width: 1024px;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
font-family: Tahoma, Helvetica, Arial;
|
||||
font-size: 1.2em;
|
||||
box-sizing: border-box;
|
||||
background: #24f;
|
||||
color: white;
|
||||
line-height: 150%;
|
||||
}
|
||||
|
||||
form > div, label {
|
||||
display: block;
|
||||
padding-top: 8px;
|
||||
padding-bottom: 8px;
|
||||
}
|
||||
|
||||
input, textarea {
|
||||
background: rgba(0,0,0,0.2);
|
||||
border: 2px solid rgba(255,255,255,0.2);
|
||||
}
|
||||
|
||||
input[type=submit], button {
|
||||
padding: 8px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
input[type=submit]:hover, button:hover {
|
||||
color: yellow;
|
||||
background: rgba(0,0,0,0.5);
|
||||
}
|
||||
|
||||
input[type=text], textarea {
|
||||
padding: 8px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
input[type=text]:hover, textarea:hover {
|
||||
background: rgba(0,0,0,0.25);
|
||||
}
|
||||
|
||||
textarea {
|
||||
height: 20%;
|
||||
}
|
||||
|
||||
pre {
|
||||
height: 20%;
|
||||
overflow: auto;
|
||||
padding. 8px;
|
||||
border: 2px solid rgba(0,0,0,0.2);
|
||||
background: rgba(100,100,100,0.15);
|
||||
}
|
||||
Reference in New Issue
Block a user