General discussion

Locked

Including addtnl data on form submit

By BrainCramp ·
I have an html file containing a form. This html file will also be receiving a parameter.

How can I send this parameter along with the form data to a cgi script (php). The "Submit" will send along the form data but I also need the parameter sent.If the answer is to use a "Hidden" field on the form, how would I set its value to the parameter?

This conversation is currently closed to new comments.

9 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Including addtnl data on form submit

by halleyc In reply to Including addtnl data on ...

try to use hidden field in form. Such as

<form>
<input type=text name-name value=something>
<input type=hidden name=hideme vlaue=invisible>
</form>

Collapse -

Including addtnl data on form submit

by BrainCramp In reply to Including addtnl data on ...

My question was how do I feed this parameter into the hidden field

Collapse -

Including addtnl data on form submit

by GeoffreyC In reply to Including addtnl data on ...

Using the hidden field as has been noted, you use the onSubmit event to fill the field, either via subroutine, or directly.

<form action="" method="" onSubmit="
FormName.HiddenBoxName.value = newvalue;"

Here newvalue would be the parameter you want sent to the form's destination.

Collapse -

Including addtnl data on form submit

by BrainCramp In reply to Including addtnl data on ...

The question was auto-closed by TechRepublic

Collapse -

Including addtnl data on form submit

by Cedric King In reply to Including addtnl data on ...

If you are using PHP, then you can write:
<Input Type="Hidden" Name="Para" Value="<%=Parameter Value%>">

Or you can write in the script to execute the following line before a Submit is done:
document.ThisForm.HiddenFieldElement.Value = "<%=Parameter Value%>"

Hope I understand and answer your question.

Collapse -

Including addtnl data on form submit

by BrainCramp In reply to Including addtnl data on ...

The question was auto-closed by TechRepublic

Collapse -

Including addtnl data on form submit

by rw2000 In reply to Including addtnl data on ...

I don't deal with cgi scripts, but I'm guessing that YourAction.asp would reference your cgi script instead of the asp file.
....
<script Language="VBScript">
<!--
Function InputForm_onsubmit()
document.InputForm.Param.value = document.parametername
End Function
-->
</script>
<HTML>
<BODY>
<form name="InputForm" onsubmit=InputForm_onsubmit() method="POST" action="YourAction.asp">
<input TYPE="hidden" NAME="Param" VALUE="0">

Collapse -

Including addtnl data on form submit

by BrainCramp In reply to Including addtnl data on ...

The question was auto-closed by TechRepublic

Collapse -

Including addtnl data on form submit

by BrainCramp In reply to Including addtnl data on ...

This question was auto closed due to inactivity

Back to Web Development Forum
9 total posts (Page 1 of 1)  

Related Discussions

Related Forums