Author Topic: CGI & the submit button  (Read 1122 times)

xyle_one

  • VIP
  • Member
  • ***
  • Posts: 2,213
  • Kudos: 135
CGI & the submit button
« on: 17 January 2003, 13:39 »
How hard would it be to write a cgi script for a submit button on my webpage? Or, better yet, where can i find a good resource to learn some basics, or pick up a free script.
Im not really sure what cgi is, but it looks like i am going to need it for this site. Is it easy to learn (like html is easy)?
(goddamn, i am such a noob!  ;)  )

voidmain

  • VIP
  • Member
  • ***
  • Posts: 5,605
  • Kudos: 184
    • http://voidmain.is-a-geek.net/
CGI & the submit button
« Reply #1 on: 17 January 2003, 13:50 »
It sounds like you already have a web page with a "form" containing a "submit" button correct? Usually the purpose of this is to take data (input) from a user using your web page and doing something useful with it (like insert it into a database, email a message etc). I assume you already know all of the pieces up to this point.

Are you using an Apache based web server? If so you can use use Perl, a shell script, C, or really any other language to create a CGI program to take the data from your form and do something with it. However, my personal favorite is PHP (which is not a CGI program) or Perl (which may or may not be a CGI program depending on if you use modperl).

I would suggest you start with PHP as I believe it to be the easiest to learn (and just as good to use if not better in many cases). You can have a single PHP file that will generate the form and do something with the data when you click on the submit button. There are a million resources out on the internet that can be found with a simple search on google. I would suggest browsing over http://www.phpbuilder.com and http://www.php.net (which is the ultimate reference and the main site for PHP itself).

What do you want your program to do? I could write a simple example for you or point to you a place where you can probably just download the code.

It is helpful if you have a good working knowlege of HTML (which FORM is a part of). For examples of HTML programming using forms search google for "html forms tutorial". For using HTML forms in PHP scripts search google or one of the previous links for "php forms tutorial" should dig up some good info.

[ January 17, 2003: Message edited by: void main ]

Someone please remove this account. Thanks...

xyle_one

  • VIP
  • Member
  • ***
  • Posts: 2,213
  • Kudos: 135
CGI & the submit button
« Reply #2 on: 17 January 2003, 13:57 »
i have the form and the html written. The webserver is running apahce on Redhat. What i want it to do is collect user info (name, address, email) so i can send them a demo cd. Id also like to have the script email them a default message saying that i have recieved their info and they should be getting the cd in the mail soon...
i actually wanted to learn php, after i was finished with the stupid flash action scripting (i am almost finished with the book). if i could do it in php, that would be cool. I googled for cgi resources and there are quite a few places. I thought i would ask here since everyone seems to know there shit (very well i might add... okay, enough of this ass-kissing  ;)  )

voidmain

  • VIP
  • Member
  • ***
  • Posts: 5,605
  • Kudos: 184
    • http://voidmain.is-a-geek.net/
CGI & the submit button
« Reply #3 on: 17 January 2003, 14:05 »
Would you like this information that you collect stored in a database (MySQL or PostgreSQL)? Or would you like it stored in a text file? Or something else? Or would you just like the information to be emailed to you?

You will also need to make sure your system can send mail. If it can't you may need to get sendmail configured properly. You can test it by typing:

$ echo testing | mail [email protected]

on the command line.

Also give me a link to your web page so I can view the source and see what variables you are collecting and I can whip up an example that you can modify to your liking.
Someone please remove this account. Thanks...

xyle_one

  • VIP
  • Member
  • ***
  • Posts: 2,213
  • Kudos: 135
CGI & the submit button
« Reply #4 on: 17 January 2003, 14:21 »
my site will be hosted on ipowerwebs servers. They have a kick ass deal. these are their features..
the address is ecsyle.com/roy/demo
     
quote:
Would you like this information that you collect stored in a database (MySQL or PostgreSQL)? Or would you like it stored in a text file? Or something else? Or would you just like the information to be emailed to you?

a text file would be cool. i dont really want to deal with a database. unless its not that much of a headache and will make things easier later on.
i wish i was hosting it on my own server, but my isp doesnt really like to dish out static ip addresses to home users. I could upgarde, i get 5 static ips, but no increase in bandwidth and it costs like $150 a month!!

on a side note... how does it load right now?? slow?

[ January 17, 2003: Message edited by: Xyle: iGeek... ]



xyle_one

  • VIP
  • Member
  • ***
  • Posts: 2,213
  • Kudos: 135
CGI & the submit button
« Reply #6 on: 18 January 2003, 04:12 »
nevermind.

[ January 17, 2003: Message edited by: Xyle: iGeek... ]