Solved

Problem with form.

Posted on 2000-05-01
17
185 Views
Last Modified: 2010-04-09
This form is for a cgi application that does a search. The application is written in C++. when I write the text in the box and click submit it prompts me to save the .exe file. Why is it doing this?

html>

                 <head>
                 <meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
                 <meta name="generator" content="Microsoft FrontPage 4.0">
                 <title>Search Engine</title>
                 </head>

                 <body>
                 <form action=".\cgi-stringg.exe" method="get">
                 <p><input type="text" name="town" size="24"> <input type="submit" name="submitButtonName"></p>
                 <p><input type="checkbox" value="checkboxValue" name="checkboxName1">By Name</p>
                 <p><input type="checkbox" value="checkboxValue" name="checkboxName2">By Location
                 </body>

                 </html>
0
Comment
Question by:milalik
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 5
  • 3
  • +1
17 Comments
 
LVL 33

Expert Comment

by:knightEknight
ID: 2766156
The action of the form must point to a web server and a directory on that server that has execute permissions.  Most web-servers will call this directory cgi-bin or something like that.  Is your .exe name "cgi-stringg.exe" or should it be "cgi/stringg.exe" ?
0
 
LVL 33

Expert Comment

by:knightEknight
ID: 2766159
On a typical web server, I would expect to see something like this:

<form action="/cgi-bin/stringg.exe" method="post">
0
 
LVL 8

Expert Comment

by:bebonham
ID: 2766398
Are you running your site on a unix server?
you have to chmod 755 myfile.exe
to make it work there....

on IIS...well, I'm not as familiar, but you are certiainly dealing with a permissions issue.

you have not given everyone access to execute this file

talk to your web host if you are totally lost by this.  It's a very simple problem to fix.

Hope the helps
Bob Bonham
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:milalik
ID: 2768786
knightEknight..why post instead of get?

The server is unix. The files are chmod 755.
0
 
LVL 33

Expert Comment

by:knightEknight
ID: 2769177
Just a typo -- post or get will both work.  If the file is 755, then the problem is probably with the cgi directory itself.  You must have a web-server administration application -- I'm not sure exactly how it will look on your server, but somewhere in there you can specify which directory(s) can have execute permissions.  Also, (I assume you know this, but) the first line of code from your CGI program must define the content type ... something like this:

Content-type:text/html

<HTML>
This is my CGI output
</html>
0
 

Author Comment

by:milalik
ID: 2771421
My output is generated by a C++ program and it has those lines that you mentioned there.
0
 

Author Comment

by:milalik
ID: 2776801
I am still having problems with the form.

It is at http://amadeus.uprm.edu/~banjo

It sends me to ablank page
0
 
LVL 33

Expert Comment

by:knightEknight
ID: 2777312
you are missing the </form> tag at the bottom of the form -- but that won't solve the CGI problem.  It has something to do with the configuration of the cgi-bin directory.  I suggest you make a simpler cgi program for testing that doesn't require any form input.  A simple "hello world" cgi that you can hit with your browser.  For example, in C, do this:


void main()
{
  printf("Content-type: text/html\n\n"
          "<HTML>\n<BODY>\n"
          "<CENTER><B>Hello World</b></center>\n"
          "</body>\n</html>\n" );
}

compile this and call it "cgitst.txt", put it in cgi-bin, then hit it with this URL:

http://amadeus.uprm.edu/~banjo/cgi-bin/cgitst.exe

If you get data back then your cgi-bin directory is configured correctly, otherwise not.
0
 

Author Comment

by:milalik
ID: 2777554
It doesn't work with the exe extension but ir does with the cgi one. my cgi application is in C++.
0
 
LVL 33

Accepted Solution

by:
knightEknight earned 39 total points
ID: 2777851
Yes, the filename is not relavent as long as it has 755 permissions.

Anyway, if the test program works correctly, then the problem must be in your C++ program.  I could look at it for you if you want to post it here, or you could re-ask this question in the CGI forum (instead of the HTML forum) since it appears to be a CGI problem.
0
 

Author Comment

by:milalik
ID: 2778760
I did reask this...do you have e-mail so I can send you the code?
0
 
LVL 1

Expert Comment

by:rhinosaur
ID: 2780091
Try putting a question mark after the reference to your file. e.g.

<form action=".\cgi-stringg.exe?" method="get">

And also make sure that it is placed in a CGI-BIN directory (or similar) with the permissions correctly set.

Hope that helps.
0
 

Author Comment

by:milalik
ID: 2780095
it is ./cgi-bin/strin.cgi
0
 
LVL 1

Expert Comment

by:rhinosaur
ID: 2780103
Have you tried the question mark?

Does the CGI program create a correct HTML file header too?
0
 

Author Comment

by:milalik
ID: 2781937
nope
0
 

Author Comment

by:milalik
ID: 2783116
The cgi program works

thanx
0
 
LVL 1

Expert Comment

by:rhinosaur
ID: 2787710
Do tell ... What was the problem with it?
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
html input 8 56
Obsolete font tag need to convert to CSS 3 34
Validating Date 4 28
Change how page is organized 3 36
This article discusses how to create an extensible mechanism for linked drop downs.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question