Click to See Complete Forum and Search --> : please help


Coder456
02-19-2003, 08:07 PM
I have just begun my first project using cgi and I'm having some trouble that I hope someone can help me out with...

I have a basic HTML page to test the function user input

<html>

<head>
<title>Page</title>
</head>

<body>
<center>
<h1>Page</h1>
<hr>
<FORM
ACTION="/cgi-bin/mod.exe" METHOD="post">
NUMBER:<br>
<INPUT name="number" maxlength="16" size="16">
<br><br>

<INPUT type="submit" value ="Send">
</form>
</center>

</body>
</html>

the source for mod.exe is this(VB Code):

Option Explicit
Dim Number As String

Sub CGI_Main()
Number = Trim(GetSmallField("number"))
End Sub
Sub inter_main()
MsgBox Number
End Sub


and I'm using cgi32.bas

when I run the html and submit with any value in the box, i get a message box with a blank space, which means 2 things,

1. Number has value = ""

2. sub inter_main is called even though, as far as i know it, it should only be called when the exe is run from something other than an html.

Moving the msgbox line of code to below the "number =" line has the same effect.

Not sure why the number string has no value, after get small field has been called.

Thanks for any help you can give!

-Coder456

jeffmott
02-20-2003, 08:27 AM
A CGI script should return an HTTP header "Content-Type: text/html" and plain text for the content of the page. A MsgBox will not actually create a popup message box on the user's screen. But you say you did get a message box so I'm a little curious. Could you post a link to your page?

Coder456
02-20-2003, 04:32 PM
Well the page is on my HD,as well as the script so I guess thats why it works. However I still wonder why the variable Number doesnt aquire any value.


Coder456

jeffmott
02-20-2003, 07:05 PM
You'll have to point me toward the complete VB reference documentation or explain what GetSmallField() is supposed to do.

Coder456
02-20-2003, 07:13 PM
http://www.deakin.edu.au/~agoodman/scc381/vb-cgi.html


Thats where I found out about CGIs in general and where I got the code for the GetSmallField function.

From above link...

The GetSmallField( ) routine allows you to 'deconstruct' the data that the user has entered into the various form elements. If, for example, your form has input elements (such as text boxes) for three variables - called in the form name, idnumber and coursecode - these can be retrieved and placed into program variables:
Dim StudentName As String
Dim StudentID As String
Dim CourseCode As String
.
.
StudentName = Trim(GetSmallField("name"))
StudentID = Trim(GetSmallField("idnumber"))
CourseCode = Trim(GetSmallField("coursecode"))




Coder456

celebguy_dv
03-04-2003, 01:00 AM
http://banners.dollarmachine.com/pic/2014000/hal001.gif (http://www.kinkyceleb.com/1261795520)