Hi I'm currently building a rough prototype for my degree project and I have got a bit stuck for the last week. Basically I have a system for testers to record test results from anti-virus software. I've populated a dropdown with records from a parent table and now I would like to capture the user selected value and the users id and input this into a link table to record this. But I only wanted to capture the primary key testID for that test not the name of the test, this is where I'm stuck. If anyone has any ideas this would help me out so much.
Heres the code for the first page
<?php
//Template for all pages
$pagename="Select File Associations";
session_start();
include ("mysqli_test.php");
// css style sheet for template
echo "<link rel=stylesheet type=text/css href=stylesheet.css>";
// displays name in window tab
echo "<title>".$pagename."</title>";
// use header file
include("header.html");
// display the current date and time
echo date ('l d F Y H:i:s');
echo "<p></p>";
// display page name on the page
echo "<h2>".$pagename."</h2>";
$testsql = "SELECT testID, testName from tests";
$testresult = mysql_query($testsql);
echo "<td>Select Test:</td>";
echo "<select name= testName>";
while ($row = mysql_fetch_array($testresult))
{
echo "<option value=\"". $row['testID']."\">". $row['testName']. "</option>";
}
echo "</select>";
echo "<form method=post action= confirm_selection2.php>";
echo "<tr><td><input type=submit value='Submit'></td>";
echo "<td><input type=reset value='clear'></td></tr>";
// use footer file
include("footer.html");
?>
Then the form handling page confirm_selections.php
<?php
//Template for all pages
$pagename="confirm_selection";
session_start();
include ("mysqli_test.php");
// css style sheet for template
echo "<link rel=stylesheet type=text/css href=stylesheet.css>";
// displays name in window tab
echo "<title>".$pagename."</title>";
// use header file
include("header.html");
// display the current date and time
echo date ('l d F Y H:i:s');
echo "<p></p>";
// display page name on the page
echo "<h2>".$pagename."</h2>";
// retrieve POST data from the user selected test
$testselection=$_POST['testName'];
// check if the selections were made
if(isset($testselection)){
$instestSQL = "INSERT INTO test_performance SET
testID='$testselection'
testerID='$_SESSION['testID']);
$exeintestSQL=mysql_query($instestSQL) OR die(mysql_error());
}
// use footer file
include("footer.html");
?>