By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,630 Members | 1,252 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,630 IT Pros & Developers. It's quick & easy.

Combination 'list_item' & 'image_button' PHP/JavaScript

P: 2
I have a web-page consisting of a listbox & image buttons. I want to post to the appropriate PHP script based on which list_item and image button combination is selected, where the logic is determined by JavaScript. So far, I can determine what list_item has been selected, but how do I determine what image button was selected?

The current PHP Script & JavaScript are below.

[HTML]<form method="post" action="operation_request_navigation.php" name="operation_navigation_form" onsubmit=
"return operation()";>
<div id="Layer17" align="center">
<table height="89">
<tr>
<td align="center">
<b>
<font size="2">New Operation</b>
<select name="operations_request_type" size="1" align="center">
<option selected="selected" >Select</option>
<option>Consultant</option>
<option>Client Account</option>
</select>

</td>
</tr>
</table>

</div>
<div id="Layer18">
<table width="272" height="150" border="0" cellpadding="0">
<tr>
<td width="89" height="67">&nbsp;</td>
<td width="177"><input type="image" class="btn" id="Add" name="process_type" value="Add"
img src="images/Add.gif" alt="Add" width="126" height="37" /></td>
</tr>
<tr>
<td width="89">&nbsp;</td>
<td width="177"><input type="image" class="btn" id="View" name="process_type" value="View"
img src="images/View.gif" alt="View" width="126" height="37" /></td></td>
</td>
</tr>
</table>

<table width="271" height="197" border="0" cellpadding="0">
<tr>
<td width="89">&nbsp;</td>
<td width="176">
<a href="./logout_confirmation.php">
<img src="images/Logout.gif" alt="Logout" width="126" height="37" border="0"/></td>
</tr>
</table>
</div>
</form>
<script>
function operation() {
var f = window.document.forms.operation_navigation_form.el ements[0];
var g = f.options[0].selected;
var h = f.options[1].selected;
var i = f.options[2].selected;
if(g) {
alert("Please select an Operation");
return false;
}
if(h) {
location.href="./consulting_sr_form.php";
return true;
}
if(i) {
location.href="./operations.php";
return true;
}
}
</script>[/HTML]
Sep 14 '06 #1
Share this Question
Share on Google+
1 Reply


acoder
Expert Mod 15k+
P: 16,027
Add on onclick to each button to send the user to the corresponding page.
May 13 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.