tvote.c: add html form for creating poll - vote - simple cgi voting system for web and gopher
 (HTM) git clone git://src.adamsgaard.dk/vote
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit bb0bbb833f049070754af126b632cfa4aa9148e7
 (DIR) parent 3089fdd4c6326fa81bef1daa7b401513eaed785e
 (HTM) Author: Anders Damsgaard <anders@adamsgaard.dk>
       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(-)
       ---
 (DIR) 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=\"autofocus\" class=\"name\" />\n"
       +                "        </td>\n"
       +                "</tr>\n"
       +                "<tr>\n"
       +                "        <td width=\"100%\" class=\"input\">\n"
       +                "                <input type=\"text\" name=\"question\" value=\""
       +                "                 placeholder=\"Question\" size=\"72\" class=\"question\" />\n"
       +                "        </td>\n"
       +                "</tr>\n"
       +                "<tr>\n"
       +                "        <td width=\"100%\" class=\"input\">\n"
       +                "       <textarea rows=\"5\" cols=\"60\" name=\"options\" "
       +                "                 placeholder=\"Options (1 per line)\"></textarea>\n"
       +                "        </td>\n"
       +                "</tr>\n"
       +                "<tr>\n"
       +                "        <td nowrap class=\"nowrap\">\n"
       +                "                <input type=\"submit\" value=\"Create\" class=\"button\"/>\n"
       +                "        </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();