I am trying to get a query to run to update the status of the system whenever the radio button is selected without having to use submit buttons, but for some reason I cannot get it to work right, here is what I have so far but it isn't working, I need someone to push me in the right direction on this, thanks

 <script language="javascript">
                function update(sys_status, my_system){
                    $.post("updateStatus.php",
                    { status: "sys_status", system: "my_system" }, function(data){alert("Data Loaded: " + sys_status); });  
                }
            </script>    


             <li style='line-height: 150%'> <form method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>" id="status">
                <label title="Set Status" for="setStatus" accesskey="p">Set Status: </label>

                <input type="radio" name="status" id="status"  value="w" onclick="update('w', <?php echo $strHW_Asset;?>)"/>In Use&nbsp;
                <input type="radio" name="status" id="status"  value="i" onclick="update('i', <?php echo $strHW_Asset;?>)"/>Inactive&nbsp;
                <input type="radio" name="status" id="status"  value="n" onclick="update('n', <?php echo $strHW_Asset;?>)"/>Destroyed
                <input type="hidden" name="statusID" value="true" />
            </form>

Recommended Answers

All 2 Replies

but it isn't working

What isn't working? Did you include a link to jquery?

Yes I have jquery included in the main include file to ensure it is available in every page.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.