I am fairly new to php and even newer to PDO! what I am trying to do is change the color of the row based on selection of a drop down in my form, but I do not have a clue how to do this!
I have only been googling around for a bit about this, have not found anything that is close to what I am trying to do
here is the main table
<div class="row">
<div class="large-4 columns">
<label>Current Status
<select name="current_status">
<option>Select Status</option>
<?php foreach($statuses as $key => $value) : ?>
<option value="<?php echo $key; ?>"><?php echo $value; ?></option>
<?php endforeach; ?>
</select>
</label>
here is the "key" code
'InProgress'=>'In Progress',
'Completed'=>'Completed',
'Unstatused'=>'Unstatused'
here is the contoroller page code
<div class="large-4 columns">
<label>Select Current Status
<select name="current_status">
<?php foreach($statuses as $key => $value) : ?>
<?php
if($key == $task->current_status) {
$selected ='selected';
}else{
$selected='';
}
?>
<option value="<?php echo $key; ?>" <?php echo $selected; ?>><?php echo $value; ?></option>
<?php endforeach; ?>
</select>
</label>
</div>
<input type="hidden" name="id" value="<?php echo $task->id; ?>">
<input name="submit" type="submit" class="add_btn button right small" value="submit">
<a class="close-reveal-modal" aria-label="Close">×</a>
</form>
</div>
so what I am hoping can be done here is; if "completed" was selected in the forms dropdown - then I want to change the row color that holds that task to red, and if they select "unstatused" i want to have that table row change to blue..but i do not have a clue as to how to do this!
<table><!--start table-->
<thead><!--create the headers-->
<tr><!--the table row for the table headers-->
<th width="100">task date</th>
<th width="450">task title</th>
<th width="150">assigned to</th>
<th width="100">current status</th>
<th width="200">action</th>
</tr><!--close the table header table row-->
</thead><!--close the headers-->
<tbody><!--begin the table body-->
<?php foreach($tasks as $task) : ?>
<tr>
<td><?php echo $task->task_date; ?></td>
<td><?php echo $task->task_title; ?></td>
<td><?php echo $task->assigned_to; ?></td>
<td><?php echo $task->current_status; ?></td>
<td>
<ul class="button-group radius">
<li>
<a href="#" class="button tiny" data-reveal-id="editModal<?php echo $task->id; ?>" data-task-id="<?php echo $task->id; ?>">Edit</a>
<div id= "editModal<?php echo $task->id; ?>" data-cid= "<?php echo $task->id; ?>" class="reveal-modal editModal" data-reveal>
the row I want to change is the "current_status" row - based on if they selected "completed" or "In Progress" in the form that is used to populate the table.
JEFF- here is the full code page (the controller page)
<?php
//create database object
$db = new Database;
//bring in the contacts
$db->query("SELECT * FROM multytasklist");
//assign the resultset
$tasks = $db->resultset();
?>
<div class="row"><!--begin the row for table data-->
<div class="large-12 columns"><!--begin columns-->
<table><!--start table-->
<thead><!--create the headers-->
<tr><!--the table row for the table headers-->
<th width="100">task date</th>
<th width="450">task title</th>
<th width="150">assigned to</th>
<th width="100">current status</th>
<th width="200">action</th>
</tr><!--close the table header table row-->
</thead><!--close the headers-->
<tbody><!--begin the table body-->
<?php foreach($tasks as $task) : ?>
<tr>
<td><?php echo $task->task_date; ?></td>
<td><?php echo $task->task_title; ?></td>
<td><?php echo $task->assigned_to; ?></td>
<td><?php echo $task->current_status; ?></td>
<td>
<ul class="button-group radius">
<li>
<a href="#" class="button tiny" data-reveal-id="editModal<?php echo $task->id; ?>" data-task-id="<?php echo $task->id; ?>">Edit</a>
<div id= "editModal<?php echo $task->id; ?>" data-cid= "<?php echo $task->id; ?>" class="reveal-modal editModal" data-reveal>
<h2>EDIT TASK</h2>
<form id="edit_multytask" action="#" method="POST">
<div class="row">
<div class="large-6 columns">
<label>Task Date
<input name="task_date" type="text" placeholder="task date.." value="<?php echo $task->task_date; ?>">
</label>
</div>
<div class="large-6 columns">
<label>Task Title
<input name="task_title" type="text" placeholder="task title.." value="<?php echo $task->task_title; ?>" >
</label>
</div>
</div>
<div class="row">
<div class="large-6 columns">
<label>Task Description
<input name="task_description" type="text" placeholder="task description.." value="<?php echo $task->task_description; ?>" >
</label>
</div>
</div>
<div class="row">
<div class="large-12 columns">
<label>assigned to
<input name="assigned_to" type="text" placeholder="assigned to.." value="<?php echo $task->assigned_to; ?>" >
</label>
</div>
</div>
<div class="large-4 columns">
<label>Select Current Status
<select name="current_status">
<?php foreach($statuses as $key => $value) : ?>
<?php
if($key == $task->current_status) {
$selected ='selected';
}else{
$selected='';
}
?>
<option value="<?php echo $key; ?>" <?php echo $selected; ?>><?php echo $value; ?></option>
<?php endforeach; ?>
</select>
</label>
</div>
<input type="hidden" name="id" value="<?php echo $task->id; ?>">
<input name="submit" type="submit" class="add_btn button right small" value="submit">
<a class="close-reveal-modal" aria-label="Close">×</a>
</form>
</div>
</li>
<li>
<form id="delete_multytask" action="#" method="post">
<input type="hidden" name="id" value="<?php echo $task->id; ?>">
<input type="submit" class="delete_btn button tiny secondary alert" value="delete">
</form>
</li>
</ul><!--close unordered list-->
</td><!--close table data-->
</tr><!--close table row-->
<?php endforeach; ?>
</tbody><!--close tbody-->
</table><!--close table-->
</div><!--close 12 column class-->
</div><!--close row-->