I have a html file contains a form asking user to select a choice and press enter to pass the data to server.
In server there, i have a cgi script(C language) that accepts the input from browser and then output a html page to browser.
The browser should open the page, but it didn't, instead, it prompt me to save the file(.cgi file i requested in form method)....
how that happens?
i want to display the html file that the script output to browser, not to save that file.
here is my script:
html file
it should display that dynamic html page, how come browser ask me to save that file?
ps: i use Mozilla Firefox browser.
please anyone help...
urgent here..
thanks alot.
Nicky Eng.
In server there, i have a cgi script(C language) that accepts the input from browser and then output a html page to browser.
The browser should open the page, but it didn't, instead, it prompt me to save the file(.cgi file i requested in form method)....
how that happens?
i want to display the html file that the script output to browser, not to save that file.
here is my script:
Code:
#include <stdio.h> #include <stdlib.h> extern void cgiGetInput(); extern char *cgiGetValue(char *name); extern char *cgiGetName(); extern void cgiReset(); extern char *cgiGetKeyword(); /** Turn debuggine on or off **/ int Debug = 0; int main(int argc, char *argv[], char *env[]) { if(Debug){ fprintf(stderr, "Start of script\n"); } cgiGetInput(); /* ** print out Version Choice Form page to browser */ // output the content type printf("Content-Type: text/html\r\n"); printf("\r\n"); printf("<html><head><title>Version Choice Form</title></head>\n"); printf("<body>\n"); printf("<p class=\"title\">Versoin Choice Form!!</p>"); printf("The choice you made is %s", cgiGetValue("sound")); printf( "<form method=\"POST\">" "<input type=\"radio\" name=\"version\" value=\"original\" checked /> Original Version\n" "<input type=\"radio\" name=\"version\" value=\"dynamic\" /> dynamically-created \"echo\" version\n\n" "<input type=\"submit\" name=\"retrieve\" value=\"Retrieve Sound\" />" "</form>" ); printf("</body></html>"); return 0; }
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="EN"> <head> <title>Select a sound</title> </head> <body> <h1>Forms Page 1</h1> This page is an example of a forms page with a submit button. This is the first of 2 forms pages. Both pages call the same script. How does the script know which page has been used? <p /> <form action="assign2.cgi" method="get"> <p /> Select a sound you want to hear :<br /> Train sound<input type="RADIO" name="sound" value="train" checked /> Yes sound <input type="radio" name="sound" value="yes" /> <p /> <input type="RESET" value="Reset" /> <input type="SUBMIT" value="Next" name="form1" /> </form> </body> </html>
ps: i use Mozilla Firefox browser.
please anyone help...
urgent here..
thanks alot.
Nicky Eng.
Comment