Hello,
I am new to PHP and am currently updating someone else's web tool. I have found contradicting information regarding this issue and would appreciate any guidance in how to solve this problem.
I need the functionality that if the user has selected "no" for both of the options below, a specific part of the form should not be visible to them (by default it should also not be visible).
I have written a Javascript function that will handle this but have no idea how to properly return this information to PHP, or if PHP can get this information itself??? Any help is greatly appreciated. Please let me know if you require more information.
Thanks,
Nissa
PHP/HTML code:
<tr>
<td style="font-size: 9pt" nowrap><b>Server Required</b></td>
<td class="grey">
<table border="0" cellpadding="0" cellspacing="0">
<tr><td>
<?php
$serverreqoptions = Array (0=>"No", 1=>"Yes");
doselectbox($serverreqoptions, $bdprow[14], false, "serverrequired", false, true);
?>
<td></tr></table>
</td>
</tr>
<tr>
<td style="font-size: 9pt" nowrap><b>Storage Required</b></td>
<td class="grey">
<table border="0" cellpadding="0" cellspacing="0">
<tr><td>
<?php
$storagereqoptions = Array (0=>"No", 1=>"Yes");
doselectbox($storagereqoptions, $bdprow[14], false, "storagerequired", false, true);
?>
<td></tr></table>
</td>
</tr>
<tr>
<td class="th1" width="1"><img border="0" src="images/Expanded16.gif" width="16" height="16" onclick="expand(event)"></td>
<td class="th1">Actions Change</td>
</tr>
<tr>
<td width=1></td>
<td class="th1">
<table border="0" cellspacing="0" width="100%">
[COLOR=Red]<!-- would like to put some type of if statement just before the for loop that returns true if either server/storage are required and sets phase to start at 0 -->
[/COLOR]
<?php
$votephases = array ("A", "B", "C", "D");
for ($phase = 1; $phase < 4; $phase++) {
?>
<tr>
<td>
<?php startExpandSection($votephases[$phase], ($bdprow[0] == $phase)); ?>
Possible Javscript Function:
//note I realize this won't work when I wrote this the options were radio buttons
//this is here to show the idea behind what I want to do
function required(server, storage){
var servernoid = document.getElementById(server);
var storagenoid = document.getElementById(storage);
//if both checked "no" then isn't required
if(servernoid.checked == true && storagenoid.checked == true){
return false;
}
else
return true;
}