Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Form Action

by Joost (Canon)
on Jun 30, 2006 at 23:28 UTC ( #558701=note: print w/replies, xml ) Need Help??


in reply to Form Action

As I sort of mentioned before, you seem to be having trouble understanding program execution flow. I think you're forgetting something fairly basic:

Unless you're deliberately changing the execution flow programs are executed from top to bottom.

In other words, since the only place you assign a value to $action is at the very end, that variable will be undefined everywhere else it's being used.

You'll also want to read up on how the web works. and see Ovid's CGI course.

Replies are listed 'Best First'.
Re^2: Form Action
by Zcity (Novice) on Jul 03, 2006 at 12:55 UTC

    Thanks to All for the help. Anyways, i got it to work by doing this:

    print "Content-type: text/html\n\n"; print "<HTML>\n"; print "<HEAD>\n"; print "<TITLE>Forum</TITLE>\n"; print "</HEAD>\n"; print "<BODY>\n"; print "<FORM METHOD=POST>\n"; print "<INPUT TYPE='submit' VALUE='Preview' name='preview' onClick=thi +s.form.action='preview.cgi';this.form.target=''>\n"; print "<INPUT TYPE='submit' VALUE='Submit Reply' name='reply' onClick= +this.form.action='createreply.cgi';this.form.target=''><br>\n"; print "</FORM>\n"; print "</BODY>\n"; print "</HTML>\n";

    Code tags added by GrandFather

      using here-docs will make that output code cleaner and resolve some quoting issues (your onClick values will be problematic as-is)...
      print <<EOF; Content-type: text/html <HTML> <HEAD> <TITLE>Forum</TITLE> </HEAD> <BODY> <FORM METHOD="POST"> <INPUT TYPE="submit" VALUE="Preview" name="preview" onClick="this.fo +rm.action='preview.cgi';this.form.target=''"> <INPUT TYPE="submit" VALUE="Submit Reply" name="reply" onClick="this +.form.action='createreply.cgi';this.form.target=''"> </FORM> </BODY> </HTML>
      or, using CGI:
      print header, start_html( -title => 'forum' ), start_form( -method => 'POST' ), submit( -name => 'preview', -value=>'Preview', -onClick => "this.for +m.action='preview.cgi';this.form.target=''" ), submit( -name => 'reply', -value=>'Submit Reply', -onClick => "this. +form.action='createreply.cgi';this.form.target=''" ), end_form, end_html, ;

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://558701]
help
Chatterbox?
[Corion]: Sane Dots Supplies - your brand manufacturer for satisfying experiences!
[choroba]: preparing the trip to Vietnam + buying a new car = enough fun
[Corion]: choroba: Yeah, that's a lot of "fun" for one week...
[Corion]: I guess I should stage some product photos for Sane Dots Supplies ;)
[marto]: I had some ideas about that Corion
[marto]: I'll send a message over the weekend maybe :P
[Corion]: choroba: I avoided the "fun" of emergency shopping for a new flat iron by trying the flat iron without the timer that sat between it and the mains power. Seems as if just the timer is broken.
[Corion]: marto: Heh, would be cool!

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (9)
As of 2017-01-20 10:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you watch meteor showers?




    Results (174 votes). Check out past polls.