Submit Buttons 
Author Message
 Submit Buttons

    OK so if I have this code in a .cgi file:

<FORM ACTION=" http://www.*-*-*.com/ ; METHOD=POST>

 <INPUT TYPE="submit" NAME="some-value-here" VALUE="Send">

    How do I get my "showp.cgi" to retrieve the value 'some-value-here'???
I have
the following in my showp.cgi:

my $num;
$num = param('name');

Is this not sufficient?  I'm getting a blank $num every time.

                                                                -Thanks!



Wed, 11 Aug 2004 21:38:07 GMT  
 Submit Buttons

Quote:

>     OK so if I have this code in a .cgi file:

> <FORM ACTION="http://www.afjdas.net/cgi/showp.cgi" METHOD=POST>

>  <INPUT TYPE="submit" NAME="some-value-here" VALUE="Send">

>     How do I get my "showp.cgi" to retrieve the value 'some-value-here'???
> I have
> the following in my showp.cgi:

> my $num;
> $num = param('name');

> Is this not sufficient?  I'm getting a blank $num every time.

the way cgi works is 'name=value', so, in your example, you're expected to
already _know_ 'some-value-here'... if you wanted to get all the parameter
names, you'd use:

--
Michael Budash
Michael Budash Consulting



Wed, 11 Aug 2004 22:23:53 GMT  
 Submit Buttons
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


Quote:
>     OK so if I have this code in a .cgi file:

> <FORM ACTION="http://www.afjdas.net/cgi/showp.cgi" METHOD=POST>

>  <INPUT TYPE="submit" NAME="some-value-here" VALUE="Send">

>     How do I get my "showp.cgi" to retrieve the value
> 'some-value-here'??? I have
> the following in my showp.cgi:

> my $num;
> $num = param('name');

> Is this not sufficient?  I'm getting a blank $num every time.

#1. "some-value-here" is not a value. It's a name.  Think "name=value"

#2. Do you have 'use CGI;' at the beginning of your script ?

#3. Usually the name of a submit button has no value attached to it (or if
it does it's probably discarded)

#4. You're trying to access an element named "name" which you have not
defined in the HTML code. From what I've seen you've defined an element
named "some-value-here". Try accessing that instead.

As I said, values to submit elements are not that common. Try this instead
in your html code:


And in your perl code try accessing this:
$email = param('email');

Best of luck.  If this all seems confusing I recommend you get a hold on a
perl book that specializes in CGI scripts.

-----BEGIN PGP SIGNATURE-----
Version: 6.5.8ckt
Comment: MY PUB KEY: http://thecouch.homeip.net:81/MinaNaguib.txt

iQA/AwUBPHgLt3kvfaRjIn+sEQLvkgCg6+T1ri+FVilcOibV7yLa4tBghrwAoM7x
h1eYofKZ+bnuOdHYgLwnwl/T
=2QQe
-----END PGP SIGNATURE-----



Wed, 11 Aug 2004 22:38:00 GMT  
 Submit Buttons

(this is OT, but if you're going to answer the question I think
it should be accurate.  f'up group suggested.)

On Feb 23, Mina Naguib inscribed on the eternal scroll:

Quote:
> #3. Usually the name of a submit button has no value attached to it

That's a design decision.  It can be a useful consistency check e.g to
ensure that the submit control was actually used rather than the form
inadvertently being prematurely submitted by hitting Enter.

Quote:
> (or if it does it's probably discarded)

By whom?  It certainly isn't allowed to be discarded by the client.

If you mean that the authors of server-side scripts "probably" ignore
it, then maybe you're right, but I'm not sure that it's germane to the
issue.  Certainly if there is more than one function, performed by
hitting different submit buttons, then giving them names and values is
the natural solution.

Quote:
> #4. You're trying to access an element named "name" which you have not
> defined in the HTML code. From what I've seen you've defined an element
> named "some-value-here".

Sure, I've no disagreement there.

Quote:
> As I said, values to submit elements are not that common.

As I said, I don't think that's germane to the issue here.

Quote:
> Try this instead

Why would one need to "try" it?  Either you're confident it'll work,
or you aren't.

Quote:
> in your html code:



Why have you suddenly introduced the issue of email addresses?  This
is worrying, if you're not including the necessary caveats.

Quote:
> And in your perl code try accessing this:
> $email = param('email');

Just don't try having your script send mail to it, or else you've just
created a spamming gateway.  In the last couple of months, there's
been a distinct outbreak of massive misuse of unprotected web-to-mail
gateways: I suspect that the reason is that many of the traditional
spamming routes have already been blocked by publicly-accessible
blacklisting registers.

best regards



Wed, 11 Aug 2004 23:00:35 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Submit with a submit button

2. Question: SUBMIT data without a submit button

3. How to submit form without submit button?

4. CGI.pm automatically runs code without waiting for submit button

5. CGI Question - can't differenciate between mutlipe submit buttons

6. How to gen a submit button ?

7. Submit Buttons

8. HowTo: Submit Button Call SUB Function

9. multiple submit buttons in CGI

10. Multiple Submit Buttons

11. multiple submit buttons in CGI

12. CGI Question - can't differenciate between mutlipe submit buttons

 

 
Powered by phpBB® Forum Software