[nycphp-talk] Can this be done with PHP or JavaScript? Is it even possible?
Jim Hendricks
jim at bizcomputinginc.com
Sat Jul 20 11:53:37 EDT 2002
As far as I know, the only way to get data outside a form to be sent with
the request
would be the use of JS either to build it as part of the querystring, or to
finagle some
form elements.
But, based on what you have below, I don't see that you need all those
forms, why not
just one form. If it's a matter of determining which submit button the user
chose, then
give each submit button a different value, the selected button's value would
be associated
with the button field item available on the server side which would then let
you know
which of your hidden fields to use. For example:
<p>STEP 1. ENTER YOUR DOMAIN NAME:
<form action="https://domain.com/cgi-bin/webscr" method="post">
<input type="hidden" name="OptionName" value="Domain">
<input type="text" name="OptionValue" size="25"></p>
<p>STEP 2. CHOOSE A PLAN:</p>
<p>PLAN A 3 MONTHS
<input type="hidden" name="item1" value="PA03">
<input type="hidden" name="amount1" value="74.85">
<input type="submit" name="submit" value="submit1"></p>
<p>PLAN A 6 MONTHS
<input type="hidden" name="item2" value="PA06">
<input type="hidden" name="amount2" value="137.70">
<input type="submit" name="submit" value="submit2"></p>
<p>PLAN A 12 MONTHS
<input type="hidden" name="item3" value="PA12">
<input type="hidden" name="amount3" value="239.40">
<input type="submit" name="submit" value="submit3"></p>
</form>
----- Original Message -----
From: "SolTek" <soltek at mac.com>
To: "NYPHP Talk" <talk at nyphp.org>
Sent: Friday, July 19, 2002 8:58 PM
Subject: Re: [nycphp-talk] Can this be done with PHP or JavaScript? Is it
even possible?
> Sorry to stir up such a debate earlier, but I still do need help. :-)
> Maybe someone can assist me. I'm actually just learning PHP and was
> hoping to concentrate on that before learning anything else. But it
> seems I may not have a choice.
>
> I'm thinking this can only be done with JavaScript, but maybe I'm wrong.
>
> Is there a way I can get form values that are on the same html page as a
> form but outside of the form tags, and then pass them along with the
> rest of a forms values when a submit button of a form is clicked? The
> page must contain multiple forms. Each form will contain different
> hidden values and a submit button. The form values outside of the form
> tags will be associated with every form on the page which is why they
> must also be sent along with the rest of the particular form's hidden
> values. To help illustrate this I've included and commented the HTML
> code I'm using below.
>
> Many thanks to anyone who could help out!
> - Steve
>
>
>
>
>
>
More information about the talk
mailing list