I am looking for the cleanest way I could do the following.
<?php
function display_data($label, $yes_no, $model) {
$return = "<tr><th><label>".$label."</label></th><td>";
if ($yes_no == '1') { $return .= "Yes"; } else { $return .= "No"; }
$return .= "</td><td>";
if (isset($model)) {
$return .= $model;
}
$return .= "</td></tr>";
return $return;
}
?>
<table>
<thead>
<tr>
<th>Make</th>
<th>Yes/No</th>
<th>Model</th>
</tr>
</thead>
<tbody>
<?php
echo display_data("Ford", $car_form["available"], $car_form["avail_model"]);
echo display_data("Honda", $car_form["available"], $car_form["avail_model"]);
?>
</tbody>
</table>
I want to be able to EDIT the body contents of the table by just clicking on any of them, with say jquery. Changing the value and once I click out of it, it saves with AJAX.
So I should be able to click into any of the Yes/No or Model rows and change them. I'm going to have a lot of data, so I am not sure how to do this in large scale. I just don't want to have to create a individual jquery function, and divs for every single piece of data I have. If anyone can think of a cleaner way, that would be awesome.
Everything I have now, is working correctly, I just have not implemented a CRUD like system into this yet.