我有两页,一页通过 POST 将值传递给另一页。这些值不会显示在选择操作的第二页上。输入文本框传递它们的值。我已经包含了下面的两个页面
第一页:
mysql_connect("localhost","root","") or die("Unable to connect");
mysql_select_db("testsite");
$sql = "SELECT state FROM states";
$result = mysql_query($sql);
$sqldegrees = "SELECT degree FROM degrees";
$resultdegrees = mysql_query($sqldegrees);
$sqlschools = "SELECT school FROM schools";
$resultschools = mysql_query($sqlschools);
echo "<html>";
echo "<head>";
echo "<link rel='stylesheet' type='text/css' href='styles.css'/>";
echo "</head>";
echo "<body>";
echo "<h3>Education</h3>";
echo "<form method='post' action='educationhistoryinsert.php'>";
echo "<table border='3' width='280'>";
echo "<tr><td>State:</td><td>";
echo "<select state='state'>";
while ($row = mysql_fetch_array($result)) {
echo "<option value='" . $row['state'] ."'>" . $row['state'] ."</option>";}
echo "</select>";
echo "</td></tr>";
echo "<tr><td>School:</td><td>";
echo "<select school='school'>";
while ($row = mysql_fetch_array($resultschools)) {
echo "<option value='" . $row['school'] ."'>" . $row['school'] ."</option>";}
echo "</select>";
echo "</td></tr>";
echo "<tr><td>Degree:</td><td>";
echo "<select degree='degrees'>";
while ($row = mysql_fetch_array($resultdegrees)) {
echo "<option value='" . $row['degree'] ."'>" . $row['degree'] ."</option>";}
echo "</select>";
echo "</td></tr>";
echo "<tr><td>Subject:</td><td><input type='text' name='subject' maxlength='20'/></td>
</tr>";
echo "</table>";
echo "<table border='1'>";
echo "<tr>";
echo "<td width='5'>Month:</td><td><input style='width: 30px;' type='number'
name='month' maxlength='1'/></td>";
echo "<td width='5'>Year:</td><td><input style='width: 50px;' type='number'
name='year' maxlength='5'/></td>";
echo "<td width='5'>GPA:</td><td><input style='width: 30px;' type='number' name='gpa'
maxlength='5'/></td>";
echo "</tr>";
echo "</table>";
echo "<input type='submit' value='Save'>";
echo "</form>";
echo "</body>";
echo "</html>";
?>
=======-------------------------------- 'educationhistoryinsert.php'
<?php
$degree = $_POST['degree'];
$subject = $_REQUEST['subject'];
echo $degree."<br/>";
?>