When I simply print the query I get:
one=1&two=2&three=3&four=3&five=3&six=3
Still not working!!!! I am about to go nuts.
#include <stdio.h>
#include <stdlib.h>
int main(void){
char *data;
float prices[] = {1, 2, 3, 4, 5, 6};
int a, b, c, d, e, f;
printf("%s%c%c\n",
"Content-Type:text/html;charset=iso-8859-1",13,10);
printf("<title>Bill</title>\n");
printf("<h3 align=center >Bill</h3>\n");
data = getenv("QUERY_STRING");
if(data == NULL){
printf("<p>Error!</p>");
} else {
printf("%s", data);
sscanf(data, "one=%d&two=%d&three=%d&four=%d&five=%d&six=%d", &a, &b, &c, &d, &e, &f);
}
return 0;
}
An easy way to parse this string is using
sscanf. For this example:you could use:
More information about sscanf here: http://www.cplusplus.com/reference/clibrary/cstdio/sscanf/