First of all let me say, I am new to this and my code is probably laughable to those of you who know what you're doing...
I am trying to retrieve data from my mysql database and display the information in a matching dropdown list. I have this part working with some ugly basic code.
$url = $_SERVER["REQUEST_URI"];
$url_path = parse_url($url, PHP_URL_PATH);
$devid = pathinfo($url_path, PATHINFO_BASENAME);
$con = mysqli_connect("localhost","xxxxxx","xxxxxx","xxxxxxxx");
//Run a query
$result = mysqli_query($con,"SELECT type FROM `xxxxx`.`xxxxxx` WHERE device_id='$devid'");
$pulldown1 = '<select name="extension_type">';
while($row = mysqli_fetch_array($result))
{
if($row['type'] == "Unlimited")
{
$pulldown1 .= "<option selected value=\"Unlimited\">Unlimited Extension</option>
<option value=\"Metered\">Metered Extension</option>
<option value=\"Virtual\">Virtual Extension</option>
\n";
}
if($row['type'] == "Metered"){
$pulldown1 .= "<option selected value=\"Metered\">Metered Extension</option>
<option value=\"Unlimited\">Unlimited Extension</option>
<option value=\"Virtual\">Virtual Extension</option>
\n";
}
if($row['type'] == "Virtual"){
$pulldown1 .= "<option selected value=\"Virtual\">Virtual Extension</option>
<option value=\"Unlimited\">Unlimited Extension</option>
<option value=\"Metered\">Metered Extension</option>
\n";
}
}
$pulldown1 .= '</select>';
echo $pulldown1;
mysqli_close($con);
Now I'd like to be able to CHANGE the value and have it save the corresponding value and update that column in the database. This is where I am stuck. Can someone guide me in the right direction, please?