I’ve got a javascript that allows me to toggle between what cgi file I want to write data to with the selection of a radio button. The problem is that there is only one field name for the five choices that I have for the radio button, the field name is “operation”. In the form I need to be able to write the actual name of what they are choosing along with 1 through 5 to my database. Is it possible to have the radio button also populate a hidden field with the value of the name that is selected which would be for example General, Position Inquiry… My javascript code is below.
<html>
<head>
<title></title>
<SCRIPT language=”JavaScript”>
function OnSubmitForm()
{
if(document.myform.operation[0].checked == true)
{
document.myform.action =”write1.pl”;
}
else
if(document.myform.operation[1].checked == true)
{
document.myform.action =”write2.pl”;
}
else
if(document.myform.operation[2].checked == true)
{
document.myform.action =”write3.pl”;
}
else
if(document.myform.operation[3].checked == true)
{
document.myform.action =”write4.pl”;
}
else
if(document.myform.operation[4].checked == true)
{
document.myform.action =”write5.pl”;
}
return true;
}
</SCRIPT>
</head>
<body>
<FORM name=”myform” onSubmit=”return OnSubmitForm();” method=post>
Name: <INPUT TYPE=”TEXT” Name=”name”><br>
Email: <INPUT TYPE=”TEXT” Name=”email”><br>
<input type=”radio” name=”operation” value=”1″ checked>General
<input type=”radio” name=”operation” value=”2″>Position Inquiry
<input type=”radio” name=”operation” value=”3″>Acquisition Inquiry
<input type=”radio” name=”operation” value=”4″>Consulting Inquiry
<input type=”radio” name=”operation” value=”5″>Partnership Inquiry
<br><br>
<INPUT TYPE=”SUBMIT” name=”Submit” VALUE=” Submit “>
</FORM>
</body>
</html>