隱藏的表單域將起作用。但是,如果你決定去與PHP會議代替,take a look here.
從上面的鏈接...
<?php
// page1.php
session_start();
echo 'Welcome to page #1';
$_SESSION['favcolor'] = 'green';
$_SESSION['animal'] = 'cat';
$_SESSION['time'] = time();
// Works if session cookie was accepted
echo '<br /><a href="page2.php">page 2</a>';
// Or maybe pass along the session id, if needed
echo '<br /><a href="page2.php?' . SID . '">page 2</a>';
?>
觀看後page1.php中,第二頁則page2.php將包含會話數據。例如,Read the session reference有關propagating session ids的信息,因爲它例如解釋了常數SID的全部內容。
<?php
// page2.php
session_start();
echo 'Welcome to page #2<br />';
echo $_SESSION['favcolor']; // green
echo $_SESSION['animal']; // cat
echo date('Y m d H:i:s', $_SESSION['time']);
// You may want to use SID here, like we did in page1.php
echo '<br /><a href="page1.php">page 1</a>';
?>
UPDATE
你的片斷來看,我相信你會做這樣的事情設置會話變量:
<form action="" method="post">
<select type="select" name="servicearea" >
<option value="option1">Option 1</option>
<option value="option2">Option 2</option>
<option value="option3">Option 3</option>
</select>
<input type="submit" name="Submit" value="Submit!" />
</form>
<?php
session_start();
if (isset($_POST['Submit'])) {
$_SESSION['optionValue'] = $_POST['servicearea'];
}
echo $_SESSION['optionValue'];
?>
無論是會議或隱藏的表單字段。 – 2012-05-03 19:45:09
隱藏的表單字段聽起來像他們接近我的能力,你能詳細說明嗎? – patrick
在第2頁上的表單然後在第3頁上,您將擁有foo以及其他表單值 – 2012-05-03 19:50:08