tvote.c: add html form for creating poll - vote - simple cgi voting system for … | |
git clone git://src.adamsgaard.dk/vote | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit bb0bbb833f049070754af126b632cfa4aa9148e7 | |
parent 3089fdd4c6326fa81bef1daa7b401513eaed785e | |
Author: Anders Damsgaard <[email protected]> | |
Date: Sun, 27 Sep 2020 14:04:11 +0200 | |
vote.c: add html form for creating poll | |
Diffstat: | |
M vote.c | 36 +++++++++++++++++++++++++++++… | |
1 file changed, 35 insertions(+), 1 deletion(-) | |
--- | |
diff --git a/vote.c b/vote.c | |
t@@ -204,6 +204,39 @@ list_polls() | |
} | |
void | |
+print_poll_create_form() | |
+{ | |
+ OUT("<form method=\"get\" action=\"/?create=1\">\n" | |
+ "<table class=\"create\" width=\"100%\" border=\"0\" " | |
+ "cellpadding=\"0\" cellspacing=\"0\">\n" | |
+ "<tr>\n" | |
+ " <td width=\"100%\" class=\"input\">\n" | |
+ " <input type=\"text\" name=\"name\" value=\"" | |
+ " placeholder=\"name\" size=\"72\" autofocus=\… | |
+ " </td>\n" | |
+ "</tr>\n" | |
+ "<tr>\n" | |
+ " <td width=\"100%\" class=\"input\">\n" | |
+ " <input type=\"text\" name=\"question\" value=… | |
+ " placeholder=\"Question\" size=\"72\" class=\… | |
+ " </td>\n" | |
+ "</tr>\n" | |
+ "<tr>\n" | |
+ " <td width=\"100%\" class=\"input\">\n" | |
+ " <textarea rows=\"5\" cols=\"60\" name=\"options\" " | |
+ " placeholder=\"Options (1 per line)\"></texta… | |
+ " </td>\n" | |
+ "</tr>\n" | |
+ "<tr>\n" | |
+ " <td nowrap class=\"nowrap\">\n" | |
+ " <input type=\"submit\" value=\"Create\" class… | |
+ " </td>\n" | |
+ "</tr>\n" | |
+ "</table>\n" | |
+ "</form>\n"); | |
+} | |
+ | |
+void | |
parse_query() | |
{ | |
char *query, *p; | |
t@@ -273,7 +306,8 @@ main() | |
} else if (*poll) | |
show_poll(poll); | |
else | |
- list_polls(); | |
+ print_poll_create_form(); | |
+ /* list_polls(); */ | |
print_html_foot(); | |