I'm relatively new to coding in PHP with MySQL. Here's the problem: I want a radio button selected based off on the result I'm getting from my query. For simplicity purposes, I'm going to only select the field that I need to do the task. Overall, the entire site is a repair system for a local computer shop that I work at, and it is my senior project for a class I'm taking at my college. In the database among other fields, there is a adapterType that has the value of "cust" or "csc" for when customer's bring in their computer (mainly a laptop) and if we are using their power adapter or ours.
The query is
$query = "SELECT adapterType FROM repair WHERE repairID = '$repairID'";
$result = mysqli_query($mysqli, $query);
list($adapter) = mysqli_fetch_row($result);
If I echo out the value of adapter, I get the value that I want.
On another page, I have a list of repairs and next to each is an update button which loads the repair based off of the repairID. On the repairUpate page, I have various text fields that hold certain values that pertain to that field in the repair table. I also have a the radio buttons for the adapter type. I have
<input type=\"radio\" name=\"adapter\" value=\"csc\"> CSC A/C
<input type=\"radio\" name=\"adapter\" value=\"cust\"> Cust A/C
How can I have the correct radio button be selected or "checked" based on the value of $adapter that I get from the query?
I know this was a very long post, but I had to explain everything. Thank you for your patience.
mysqli_real_escape_string(), or other escaping, on$repairID.