Harry
07-12-2003, 11:03 PM
I have a page where I want to submit to a different page
based on a selection of radio buttons. I have written the
following script but it always goes to 'ps_page_2.php' even
if I select the radio button with a value of '4'. Can
someone please help me on this. I'm new to JS and I would
appreciate all the help I can get
Thank you
Harry
<head>
<script language="javascript1.2" type="text/javascript">
function send_form()
{
if(document.ps.a_type.value != '4')
{
document.ps.action='ps_page_2.php';
}
if(document.ps.a_type.value == '4')
{
document.ps.action='ps_send_mail.php';
}
return true;
}
</script>
</head>
<form name="ps" action="what_page.php" method="post"
onsubmit="return send_form()">
<table align="center" width="70%" background="5.jpg">
<tr>
<td align="left"><input type="radio" name="a_type" value="1" checked></td>
<td align="left"><font size="4" face="arial" color="#ffffff"><strong>New Access:</font></td>
</tr>
<tr>
<td align="left"><input type="radio" name="a_type" value="2"></td>
<td align="left"><font size="4" face="arial" color="#ffffff"><strong>Change Existing Access:</font></td>
</tr>
<tr>
<td align="left"><input type="radio" name="a_type" value="3"></td>
<td align="left"><font size="4" face="arial" color="#ffffff"><strong>Delete Some Access:</font></td>
</tr>
<tr>
<td align="left"><input type="radio" name="a_type" value="4"></td>
<td align="left"><font size="4" face="arial" color="#ffffff"><strong>Delete All Access:</font></td>
</tr>
</table
based on a selection of radio buttons. I have written the
following script but it always goes to 'ps_page_2.php' even
if I select the radio button with a value of '4'. Can
someone please help me on this. I'm new to JS and I would
appreciate all the help I can get
Thank you
Harry
<head>
<script language="javascript1.2" type="text/javascript">
function send_form()
{
if(document.ps.a_type.value != '4')
{
document.ps.action='ps_page_2.php';
}
if(document.ps.a_type.value == '4')
{
document.ps.action='ps_send_mail.php';
}
return true;
}
</script>
</head>
<form name="ps" action="what_page.php" method="post"
onsubmit="return send_form()">
<table align="center" width="70%" background="5.jpg">
<tr>
<td align="left"><input type="radio" name="a_type" value="1" checked></td>
<td align="left"><font size="4" face="arial" color="#ffffff"><strong>New Access:</font></td>
</tr>
<tr>
<td align="left"><input type="radio" name="a_type" value="2"></td>
<td align="left"><font size="4" face="arial" color="#ffffff"><strong>Change Existing Access:</font></td>
</tr>
<tr>
<td align="left"><input type="radio" name="a_type" value="3"></td>
<td align="left"><font size="4" face="arial" color="#ffffff"><strong>Delete Some Access:</font></td>
</tr>
<tr>
<td align="left"><input type="radio" name="a_type" value="4"></td>
<td align="left"><font size="4" face="arial" color="#ffffff"><strong>Delete All Access:</font></td>
</tr>
</table