I have a page that uses several queries and puts the results in a table. The first query gets a list of extensions and the secret, then the next two columns are dropdowns with the options from a query allowing the user to select different options. I have a submit to send the info to a page to insert the info into a DB. Right now the info is printed to the page so I can see what is going on. So, right now the insert page is showing One array record for the dropdown boxes, not the extension and secret. I need all the columns and all the rows in the array to insert into the DB. I am using $post method.
Insert page
I know I need to change to mysqli, I just need this to work soon and after I get it working I can work on cleaning it up. Any help is much appreciated!
Code:
$sql2 = "SELECT extension, secret from extensions;";
$result2 = mysql_query($sql2) or die(mysql_error());
echo "<table border='3'>
<tr>
<th>Extension #</th>
<th>Secret</th>
<th>MAC Address</th>
<th>Template</th>
</tr>";
while($row = mysql_fetch_assoc($result2))
{
$sql = "SELECT id , mac FROM phones order by mac;";
$result = mysql_query($sql) or die(mysql_error());
$sql1 = "SELECT id , templatename FROM templates order by templatename;";
$result1 = mysql_query($sql1) or die(mysql_error());
echo "<tr>";
echo "<td>" . $row['extension'] . "</td>";
echo "<td>" . $row['secret'] . "</td>";
echo "<td> <select name='phone'>";
while($rowA = mysql_fetch_assoc($result)) {
echo '<option value="' . $rowA['id'] . '">' . $rowA['mac'] . '</option>';
}
echo "</select></td>";
echo "<td><select name='template'>";
while($rowB = mysql_fetch_assoc($result1)) {
echo '<option value="' . $rowB['id'] . '">' . $rowB['templatename'] . '</option>';
}
echo "</select></td>";
echo "</tr>";
}
echo "</table>";
?>
<input type="submit" value="Submit your selections">
</body>
</html>
Insert page
Code:
<?php
echo "You got here";
//***********Get the Assignment information *************
$values = array_values($_POST);
print_r($values);
?>
I know I need to change to mysqli, I just need this to work soon and after I get it working I can work on cleaning it up. Any help is much appreciated!