私はexpressionengine(1.6.8)テンプレートでフォームを投稿しています。私はjqueryを使ってやっていますが、HTMLフォームも試しました - 同じ結果です。私のテンプレートにPHPが有効になっていて(フォームを含むテンプレートの入力と処理テンプレートの出力で)PHPが有効になっていて、firebugのPOST変数を見ることができますが、PHPのスーパーグローバル$ _POSTはフォームをポストした後は空です。
誰でもこの原因が考えられますか?
<html>
<head>
<script type="text/javascript" src="/_scripts/jquery-1.6.1.min.js"></script>
</head>
<body>
<form action="/select-locale/processing" method="POST">
<input type="text" name="test"/>
<input type="submit" name="submit" value="submit">
</form>
<a id="test" href="">link</a>
<script type="text/javascript">
$(function(){
$('#test').bind('click', function(e){
e.preventDefault();
var path = "/select-locale/processing"
var form = $('<form/>');
form.attr("method", "post");
form.attr("action", path);
var field = $('<input></input>');
field.attr("type", "hidden");
field.attr("name", 'locale');
field.attr("value", 'NZ');
form.append(field);
$('body').append(form);
form.submit();
});
});
</script>
</body>
</html>
サーバーサイドコード(継承され、私自身ではない):
<?php
var_dump($_POST);
var_dump($_GET);exit;
if (! isset($_POST['locale']))
{
$locale = FALSE;
$returnPage = "/";
}
else
{
$locale = $_POST['locale'];
$returnPage = $_POST['returnPage'];
}
if (isset($_GET['locale'])) {
$locale = $_GET['locale'];
$returnPage = "/";
?>
{exp:cookie_plus:set name="cklocale" value="<?php echo $locale;?>" seconds="2678400"}
{exp:session_variables:set name="userLocale" value="<?php echo $locale;?>"} <?php
}
?>
{exp:cookie_plus:set name="cklocale" value="<?php echo $locale;?>" seconds="2678400"}
{exp:session_variables:set name="userLocale" value="<?php echo $locale;?>"}
{exp:session_variables:get name="testSession"}
{if '{exp:session_variables:get name="testSession"}'=='yes' }
{redirect="<?php echo $returnPage;?>"}
{if:else}
{redirect="/nocookies/"}
{/if}
ないフォームが二回ために提出なっているように思えますフォームタグのアクション属性またはjquery関数の宣誓値のいずれか –
宣誓書とは何ですか? – codecowboy
その認証秘密鍵は、一般的にURL –