- Edited
Hi there, i'd post a month ago a feature that i needed, during this month i was trying to make it work but i cant, i have half of the way to acomplish this but i cannot store the value on the database.I'm editing the ticket-view.inc.php file, below the ticket status part.This is the code i was working on. Can somebody can help me to achieve this? <?php $servername = "localhost"; $username = "root"; $password = "dummypassword"; $dbname = "mydatabase";// Create connection$conn = new mysqli($servername, $username, $password, $dbname);// Check connectionif ($conn->connect_error) { die("Connection failed: " . $conn->connect_error);}$sql = "SELECT value,id FROM my_table where list_id=4"; //query correct on the list i've already created$result = $conn->query($sql);if ($result->num_rows > 0) { // output data of each row?> <tr> <td width="120" style="vertical-align"> <label><strong><?php echo __('Diagnostico');?>:</strong></label> </td> <td> <select name="diagnosis"><?php while($row = $result->fetch_assoc()) { echo sprintf('<option value="%d">%s</option>',$row."",$row.""); }} else { echo "0 results";}$conn->close();//at this point everything ok, check the picture below.?></select> </td></tr> </tbody> </table><?php //is my code on the right place? if(isset($_POST)){//take the boton (submit button "Post Reply") $conn = new mysqli($servername, $username, $password, $dbname); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } $value = $_POST; //take the value selected from my select $sql = "UPDATE hd_ticket SET diagn_list ='$value' where ticket_id='1975'";//test only for the ticket id, need to obtain the ticket id from a variable but so far, i couldn't :( $result = $conn->query($sql); echo "<script type='text/javascript'>alert('SQL: '+ $sql);</script>";//trying to debug what im sending to the database $conn->close();}?>Thanks in advice, here the picture showing the correct sql consult