0

如何在我已经完成的另一页中显示组合框的文本,任何人都可以引导我找到正确的答案

<select style="width:155px" name="subcategory" id="Ultra" onchange="run()">  <!--Call    run() function-->
<option value="0">Select</option>
<option value="<?=$oneYearOn?>">Employee</option>
<option value="<?=$oneYearOn1?>">Temporary</option>
</select>
<?php
$oneYearOn = date('Y-m-d',strtotime(date("Y-m-d", mktime()) . " + 7300 day"));
//echo $oneYearOn;
$oneYearOn1=date('Y-m-d',strtotime(date("Y-m-d", mktime()) . " + 40day"));
//echo $oneYearOn1;
?>
<td>Expiry date</td>
                    <td><input name="expirydate" type="text" id="srt"><br></td>
 function run() {
 document.getElementById("srt").value = document.getElementById("Ultra").value;
}

function up() {

//if (document.getElementById("srt").value != "") {
    var dop = document.getElementById("srt").value;
//}
pop(dop);

}

function pop(val) {
alert(val);
}
4

1 回答 1

1
 <form action="destinationpage.php" method="get/post">
 <select style="width:155px" name="subcategory" id="Ultra" onchange="run()">  <!--Call      run() function-->
<option value="0">Select</option>
<option value="<?=$oneYearOn?>">Employee</option>
<option value="<?=$oneYearOn1?>">Temporary</option>
</select>
</form>
 function run() {
 document.getElementById("srt").value = document.getElementById("Ultra").value;
}

function up() {

//if (document.getElementById("srt").value != "") {
   var dop = document.getElementById("srt").value;
//}
pop(dop);

  }

function pop(val) {
alert(val);
 }

在另一页

<?php

echo $_POST['subcategory']; //or
echo $_GET['subcategory'];
?>

或者你也可以使用会话变量来存储和检索..

于 2013-03-25T11:13:25.027 回答