I am working on some software that will capture information from a mysql database and dynamically output it to our form. However, I have a password problem. I will briefly talk about some of the features.
When the form loads, we have a ton of pick lists. All of them are filled with arrays with different keys / values in php. When I select an option from one list, we will call it a "list of clients", when I click, I need to check whether this client has a special flag (stored in the database) and updates another selection list based on this data.
As far as I understand the essence of my solution, I need to have the javascript trigger that I have. This function is called a link to the php page, which processes the database request through the class and its function.
<script>
function setService()
{
customer = $('#customer').val();
$.get('thePage.php?key=setService?customer='+customer);
}
</script>
This function then goes to my php. The CustomerProvider class works 100%. I checked this on other pages. The problem occurs when I try to change the selection list.
<?
if(isset($_GET['key']) && $_GET['key'] == 'setService')
{
$customer = $_GET['customer'];
$customer = intval($customer);
$s = CustomerProvider::getHasContract($customer);
if ($s != '')
{ ?> <script>var element = document.getElementById('ticket_service');
element.value = 'Contracted Hours';</script> <? }
else return;
}
?>
I am literally coding in javascript for the first time, and they just threw me into this project. I know that my part is not readable as html or output, as I assume. I know that every other part of php and the first bit of javascript seem to work fine. Any help would be incredibly appreciated.
source
share