在下一页显示组合框的文本

时间:2013-03-25 11:08:48

标签: php combobox

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

<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);
}

1 个答案:

答案 0 :(得分: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'];
?>

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