Form Action

Reply

Join Date: Sep 2009
Posts: 2
Reputation: tomthecarrot is an unknown quantity at this point 
Solved Threads: 0
tomthecarrot tomthecarrot is offline Offline
Newbie Poster

Form Action

 
0
  #1
Sep 13th, 2009
Hello. I am a newbie to HTML and I am trying to make a form. The problem is that every HTML tutorial website I look at has a form with:
HTML and CSS Syntax (Toggle Plain Text)
  1. action="whatever.cgi"
but they don't give me the code to that CGI file. What am I supposed to do with a CGI file?
Last edited by tomthecarrot; Sep 13th, 2009 at 1:35 am.
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 101
Reputation: ingeva is an unknown quantity at this point 
Solved Threads: 9
ingeva ingeva is offline Offline
Junior Poster

Re: Form Action

 
0
  #2
Sep 13th, 2009
Originally Posted by tomthecarrot View Post
HTML and CSS Syntax (Toggle Plain Text)
  1. action="whatever.cgi"
but they don't give me the code to that CGI file. What am I supposed to do with a CGI file?
From WIKI:
"A CGI file is a Common Gateway Interface Script file. Learn how to open a CGI file or convert a CGI file to another file format."

So CGI is a general specification for a file that can handle "something".
Personally I use php, which is a step "above" HTML. You can also use Perl, Python, C, or other programming languages.

This means that as a newbie you'll probably have problems knowing what to do. I suggest that the first you do is to learn HTML fairly well, and then php, which is a modern script language which executes efficiently and doesn't need compilation (like for instance C). The only drawback of php compared to a "proper" programming language is that debugging is rather clumsy -- but some debugging aids exist.

In order to not leave you in the dark I'll give you a simple example:

HTML and CSS Syntax (Toggle Plain Text)
  1. HTML:
  2. <form method='post' action='action.php'>
  3. <input type='text' name='username' value='Name here!' size='24' />
  4. <input type='submit' value='Click this button to update!' />
  5. </form>
  6.  
  7. php, file "action.php":
  8. <?php
  9. if (isset ($_POST[username])) $name = $_POST[username];
  10. // Process "$name" further.
  11. ?>

Remember, this is just the basic!
Yes, I'm running Ubuntu. Of course.
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 2
Reputation: tomthecarrot is an unknown quantity at this point 
Solved Threads: 0
tomthecarrot tomthecarrot is offline Offline
Newbie Poster

Re: Form Action

 
0
  #3
Sep 13th, 2009
Thanks for the HTML code, now I need the CGI file code as well. I don't know how to do a form action in CGI. Thanks.
Reply With Quote Quick reply to this message  
Join Date: Apr 2009
Posts: 119
Reputation: JugglerDrummer is an unknown quantity at this point 
Solved Threads: 15
JugglerDrummer's Avatar
JugglerDrummer JugglerDrummer is offline Offline
Junior Poster

Re: Form Action

 
0
  #4
Sep 13th, 2009
An html websites would give you the html side of things. If you want to do the server side part, look at some php/asp.net or other server side form tutorials.
92% of all statistics are made up on the spot.

If you found a post helpful, please click the "give XXX reputation" link, to show your appreciation to those who helped you. Thanks! :D
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 1,325
Reputation: almostbob has a spectacular aura about almostbob has a spectacular aura about 
Solved Threads: 161
almostbob's Avatar
almostbob almostbob is offline Offline
Nearly a Posting Virtuoso

Re: Form Action

 
0
  #5
Sep 13th, 2009
Well as a tutorial exercise,
go to big nose bird http://bignosebird.com/cgi.shtml and get the all-in-one form processing script,
its very well commented and documented within the code, so you can point your form at this form handler and see/learn what it is doing.
cgi scripts are text and you can read them with your text editor
Failure is not an option It's included free
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it

Please mark solved problems, solved
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 101
Reputation: ingeva is an unknown quantity at this point 
Solved Threads: 9
ingeva ingeva is offline Offline
Junior Poster

Re: Form Action

 
0
  #6
Sep 14th, 2009
Originally Posted by tomthecarrot View Post
Thanks for the HTML code, now I need the CGI file code as well. I don't know how to do a form action in CGI. Thanks.
CGI is a generic term. You can do it in perl, python or php. There's no CGI language (AFAIK).

php does the job quick and easy. The key is in the three lines I gave you. I suggest you learn php before you go any further with this. You can, however, find scripts on the Net that will do much more than my little snippet. I just showed you how to fetch a value.

BTW; php etc. is somewhat off-topic for this forum.
Last edited by ingeva; Sep 14th, 2009 at 9:09 am.
Yes, I'm running Ubuntu. Of course.
Reply With Quote Quick reply to this message  
Reply

Tags
cgi, form

Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC