$_GET を使用して元のフォーム ページにリダイレクトし、エラーを表示するフォームがあります。しかし、フォーム自体はページの下に配置されています。両方を使用する正しい方法は何ですか?
私は試したwww.abc.com/index.php?error=missing_input&#review
うん、それは間違いなく私のために働いています:
<?php
if (!isset($_GET['submitted'])) {
echo "<form action='#fragment'><input type='text' name='text'><input type='submit' name='submitted' value='Do it'></form>";
} else {
echo "<div style='height: 800px'>Vertical Padding<br>Your text was: {$_GET['text']}</div><div id='fragment'>This is the fragment</div>";
}
うまくいかない場合は、生成しているページに参照 ID を持つ要素がないか、URL フラグメント アンカーの仕組みについて一般的に間違った考えを持っていると思われます。
その単純なコードを試してみて、さらに問題があれば私に戻ってきてください。
rfc3986 仕様については、 http ://www.ietf.org/rfc/rfc3986.txt のリンクを参照してください。
foo://example.com:8042/over/there?name=ferret#nose
\_/ \______________/\_________/ \_________/ \__/
| | | | |
scheme authority path query fragment
| _____________________|__
/ \ / \
urn:example:animal:ferret:nose
「missing_input」の後の「&」を削除してみて、それが機能するかどうかを確認してください。