セッションを使用して、ユーザーがフォームに入力したものを保存し、入力したものが他のページに表示されます。
それは完全に正常に機能していましたが、すべてのサーバーがアップロードされた後、私のコードは完全に私のコードを実行してしまい、道に迷ってしまいました。
誰かが間違いを見つけることができるかどうかを確認できますか? 新鮮な目が必要です。
HTML。
<div id="form"><!--Form Start-->
<form action="home.php" method="post">
<p>Enter Name <input type="text" id="full_name" name="fullName" class="name_input"/>
<input type="submit" name="submit" value="Submit" />
</p>
</form>
</div><!--Form end-->
PHP。
<?php
session_start(); // declaring the variable
if(isset($_POST['fullName'])){ //setting the variable
if(empty($_POST['fullName'])){ //if empty dont to nothing but my wep page will reload
}else{ //if they have do this
$_SESSION['fullName'] = $_POST['fullName']; //get the session for the name (From the from)
header("Location: home.php"); //then will direct the user to the home page (will also display name on each page)
}}
?>
他のページでのセッション
<div id="echo"> <!-- div ECHO start -->
<?php
echo $_SESSION['fullName']
?>
</div> <!--div ECHO end -->