sudsey
04-20-2009, 01:35 AM
Hi I'm writing a CGI script that creats a HTML page. On the buttons the CGI script creates I need to invoke a function in the OnClick event. I need to call one function multiple times however I get the error " ')' expected " but the calling of the function works from the onclick event when I call it once. Here's the code that causes the error:
while (fgets(pref, 5, fp)) {
getc(fp); // space
fgets(ptype, 4, fp);
getc(fp); // space
fgets(pname, 56, fp);
getc(fp); // space
fgets(price, 7, fp);
getc(fp); // space
fgets(delay, 4, fp);
getc(fp); // space
fgets(stock, 4, fp);
getc(fp); // space
fgets(altref, 5, fp);
fgets(line, 80, fp); // trailing spaces and newline char
printf("<tr>");
printf("<td>"); printf(pname);
printf("<td>"); printf(ptype);
printf("<td>"); printf("£");printf(price);
printf("<td>"); printf("<input type='Button'id=%i value='View' align='middle' onclick='cat2(); cat(%s); cat(%s); cat(%s); cat(%s); cat(%s); cat(%s); cat(%s); cat1();'>", temp, pref, pname, ptype, price, stock, delay, altref);
printf("</td>");
printf("</tr>");
temp++;
}
The function I need to call mutilple times is cat(%s), is my syntax wrong?
while (fgets(pref, 5, fp)) {
getc(fp); // space
fgets(ptype, 4, fp);
getc(fp); // space
fgets(pname, 56, fp);
getc(fp); // space
fgets(price, 7, fp);
getc(fp); // space
fgets(delay, 4, fp);
getc(fp); // space
fgets(stock, 4, fp);
getc(fp); // space
fgets(altref, 5, fp);
fgets(line, 80, fp); // trailing spaces and newline char
printf("<tr>");
printf("<td>"); printf(pname);
printf("<td>"); printf(ptype);
printf("<td>"); printf("£");printf(price);
printf("<td>"); printf("<input type='Button'id=%i value='View' align='middle' onclick='cat2(); cat(%s); cat(%s); cat(%s); cat(%s); cat(%s); cat(%s); cat(%s); cat1();'>", temp, pref, pname, ptype, price, stock, delay, altref);
printf("</td>");
printf("</tr>");
temp++;
}
The function I need to call mutilple times is cat(%s), is my syntax wrong?