SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Sep 2001
    Posts
    31
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    C/C++ and HTML Form?

    Hi,

    I was wondering can I use a compiled C program with HTML form (in the action attribute)?

    Say I have a database search program coded in C and compiled. Can I set this program as the value for the action attribute of a form in a HTML document? How can I pass other attributes (such as the query) to my search program when someone clicked on the search button?

    Do I have to use XML or SOAP for this?

    Any advise greatly appriciated.
    Thanks

  2. #2
    SitePoint Columnist Skunk's Avatar
    Join Date
    Jan 2001
    Location
    Lawrence, Kansas
    Posts
    2,066
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You need to look in to CGI (the common gateway interface). CGI is a protocol used to allow web browsers to communicate with server side programs, such as your compiled C program. You will need to find out how to configure your web server but once you do the information sent by the form will be made available to your program either via standard input (for POST forms) or in an environment variable (for GET forms). Other environment variables will also be set up containing things like the user's IP address, their browser identification string and so on.

    An easier option if your search tool is command line based would be to write a "wrapper" script in a language such as Perl or PHP that can accept inormation from a form, run the command line program (using an exec() function call) and grab and parse the output for display as HTML.

    Hit google and search for "cgi" for more information


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •