coding for a button ?

P

paul814

How do I code for a submit button when I have radio buttons and
option group lists?

Do I use If then else?

I have an option group list: lstdepartment
I have radio button group: radReadWrite

and a submit button btnsubmit

So I want to do stuff like this:
If RadRead and lstPress is selected, goto "page2"
If RadRead and lstMailRoom is sele4cted goto "page3" etc. when the
button is pressed

how would I do this? where do I put the code?? what would the code be
for something like this?

Code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Production Report</title><style type="text/css">
<!--
..style2 {font-size: 24px}
..style5 {font-size: 18px}
-->
</style></head>

<body>
<center>
<p><img src="http://info/test/etnlogored2.gif" width="199"
height="30" /></p>
<p>&nbsp;</p>
<p><em><strong><span class="style2">What would you like to do?:</
span></strong></em></p>
<form id="form1" name="form1" method="post" action="">
<p>
<label>
<input type="radio" name="radReadWrite" value="1"
id="radReadWrite_0" />
<span class="style5">Write Report</span></label>
<br />
<label>
<input type="radio" name="radReadWrite" value="2"
id="radReadWrite_1" />
<span class="style5">View Report</span></label>
<br />
</p>
</form>
<p><em><strong><span class="style2">Please also select the
department:</span></strong></em></p>
<form id="form2" name="form2" method="post" action="">
<p>
<select name="lstdepartment" id="lstdepartment">
<option value="lstEditorial">Editorial</option>
<option value="lstPrepress">Pre Press</option>
<option value="lstInformationTechnology">Information
Technology</option>
<option value="lstPres">Press</option>
<option value="lstMailroom">Mail Room</option>
<option value="lstCirculation">Circulation</option>
</select>
</p>
</form>
<form id="form3" name="form3" method="post" action="">
<input type="submit" name="btnSubmit" id="btnSubmit"
value="Submit" />
</form>
<p>&nbsp;</p>
</center>

</body>
</html>
 
B

Beauregard T. Shagnasty

How do I code for a submit button when I have radio buttons and
option group lists?

You tell your receiving script what to do. You have not yet specified
one it the 'action' attribute:
how would I do this? where do I put the code?? what would the code be
for something like this?

In the action script. Write it to read the values for each id. Type of
code depends on the language used in your script.

Next time, post a URL instead of code.
 
J

Jonathan N. Little

How do I code for a submit button when I have radio buttons and
option group lists?

Do I use If then else?

I have an option group list: lstdepartment
I have radio button group: radReadWrite

and a submit button btnsubmit

So I want to do stuff like this:
If RadRead and lstPress is selected, goto "page2"
If RadRead and lstMailRoom is sele4cted goto "page3" etc. when the
button is pressed

how would I do this? where do I put the code?? what would the code be
for something like this?

You put the code in the receiving server-side script. The PHP, CGI, ASP,
CFM.... whatever language your use that *should* be listes in the form's
ACTION attribute.
Code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Production Report</title><style type="text/css">
<!--
.style2 {font-size: 24px}
.style5 {font-size: 18px}
-->
</style></head>

<body>
<center>
<p><img src="http://info/test/etnlogored2.gif" width="199"
height="30" /></p>
<p>&nbsp;</p>
<p><em><strong><span class="style2">What would you like to do?:</
span></strong></em></p>
<form id="form1" name="form1" method="post" action="">
<p>
<label>
<input type="radio" name="radReadWrite" value="1"
id="radReadWrite_0" />
<span class="style5">Write Report</span></label>
<br />
<label>
<input type="radio" name="radReadWrite" value="2"
id="radReadWrite_1" />
<span class="style5">View Report</span></label>
<br />
</p>
</form>
<p><em><strong><span class="style2">Please also select the
department:</span></strong></em></p>
<form id="form2" name="form2" method="post" action="">
<p>
<select name="lstdepartment" id="lstdepartment">
<option value="lstEditorial">Editorial</option>
<option value="lstPrepress">Pre Press</option>
<option value="lstInformationTechnology">Information
Technology</option>
<option value="lstPres">Press</option>
<option value="lstMailroom">Mail Room</option>
<option value="lstCirculation">Circulation</option>
</select>
</p>
</form>
<form id="form3" name="form3" method="post" action="">
<input type="submit" name="btnSubmit" id="btnSubmit"
value="Submit" />
</form>
<p>&nbsp;</p>
</center>

</body>
</html>


You also have 3 independent forms here. I don't think that is what you
want. Only the name|value pairs within the form that is submitted is
transmitted.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,240
Members
46,828
Latest member
LauraCastr

Latest Threads

Top