0

i designed 2 html pages,here i find some same code for check boxes in 2 pages .i want this one ,when i select the checkbox in first page ,then automatically select the same checkbox in the 2nd page .how can i do this one?

my code for chk box in 2 pages

Would you like to make this available for others to copy ?

Yes
No

4

3 に答える 3

1

これを html フォームにします。

<form action="your/action" method="POST" name="form">
      <input type="checkbox" name="postCheckBox" value=""/>
<input type="submit" value="submit"/>
</form>

/your/action.php ページ内

$_SESSION['postCheckBox'] = isset($_POST["postCheckBox"]) ? $_POST["postCheckBox"] : null;

次の HTML ページで:

<input type="checkbox" name="somename" <?php echo isset($_SESSION['postCheckBox']) && $_SESSION['postCheckBox'] == 1 ? 'checked="true": ""' ?>value=""/>
于 2012-07-03T10:56:59.603 に答える
0

これを行う最も簡単な方法は、セッションに値を追加して、別のページでそれを読むことだと思います。

于 2012-07-03T10:41:33.497 に答える