Skip to content

Instantly share code, notes, and snippets.

@peaceman
Created April 6, 2011 08:35
Show Gist options
  • Save peaceman/905338 to your computer and use it in GitHub Desktop.
Save peaceman/905338 to your computer and use it in GitHub Desktop.
crap
#include <stdio.h>
#include <string>
#include <iostream>
#include <conio.h>
std::string genHtmlForm(std::string formAction, int position, std::string* beschriftung, int anzahl) {
std::string toReturn = "<html><body><form action=\"" + formAction + "\" method=\"post\">";
toReturn += "<table align=\"";
switch (position) {
case 1:
toReturn += "left";
break;
case 2:
toReturn += "center";
break;
case 3:
toReturn += "right";
break;
}
toReturn += "\">";
for (int i = 0; i < anzahl; i++) {
toReturn += "<tr>";
toReturn += "<td>" + beschriftung[i] + "</td>";
toReturn += "<td><input type=\"text\" name=\"" + beschriftung[i] + "\"></td>";
toReturn += "</tr>";
}
toReturn += "<tr><td><input type=\"submit\" ></td></tr>";
toReturn += "</table></form></body></html>";
return toReturn;
}
int main() {
std::string descr[2] = {"sdf", "rofl"};
std::cout << genHtmlForm("rolfAction", 2, descr, 2) << std::endl;
getch();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment