I have two files:
web_directory_body.html (only important snippets)
<form name="web_directory_form" id="web_directory_form" method="POST" action="web_directory.php">
<tr>
<td width="35%"><b>Status</b></td>
<td width="65%">
<select name="status_id" id="status_id">
<option value="-1">All</option>
<option value="0">Active</option>
<option value="1">Inactive</option>
</select>
</td>
</tr>
web_directory.php (only important snippets)
$dir_search = array();
$action = 'search';
$params = array(
'profile' => 'profile',
'employee_no' => 'employee_no',
'mcr_no' => 'mcr_no',
'name' => 'name',
'dept' => 'dept',
'section' => 'section',
'designation' => 'designation',
'mobile_no' => 'mobile_no',
'no_mobile' => 'no_mobile',
'username' => 'username',
'user_role' => 'user_role',
'login_access' => 'login_access',
'status_id' => 'status_id',
'user_type' => 'user_type'
);
my goal for this is to only have "status active" whenever there is no user and for the option tag to be disabled/greyed out if this is the case. If someone logs in, they have the additional options "All" and "Inactive". here is my code for that (working, tested on other parts of my system)
if($_SESSION['user_name'] == "")
else
My problem is that the html file and the backend are separated (not my system originally) I need to somehow do a disable of the option tag of the html file inside my php file. Would like some advice on how to do that.
What I have tried:
-
It somehow works if I change "'status_id' => 'status_id'," to an appropriate value like "'status_id => 0," but the issue is the dropdown options can still be seen and clicked, I would like to have them disabled (if no user is logged in, only shows Active).
-
I also cannot simply add the whole of the Status to my if else statement, since the original option tag is still back at the html file.
any help would be appreciated thank you for reading.
EDIT: please do not vote to close, if it is still not clear I will gladly elaborate more
Aucun commentaire:
Enregistrer un commentaire