Oturumu sıfırlamak $ _SERVER ['PHP_SELF'] kullanarak mı?

0 Cevap

Ben oturumu değer ben formu göndermek her zaman reset ediliyor bulma yaşıyorum. Şöyle pasajı:

 <? php session_start(); ?>
<html>
<head>
</head>
<body>
<?php
if($_SESSION['idi']=="")
{
$_SESSION['idi'] = $_GET['id6'];
$_SESSION['class1'] = $_GET['class6'];
$_SESSION['section1'] = $_GET['section6'];
}
echo $_SESSION['idi'].' '.$_SESSION['class1'].' '.$_SESSION['section1'].'<br>';
print session_id(); 
?>
<form method="post" action="">
<table>
<tr>
    <td> <label> CLASS NAME </label>
    <td><input type="text" name="class_name" value="<?php echo $_SESSION['class1'] ;?>"></td>
</tr>
<tr>
    <td><label> SECTION </label>
    <td><input type="text" name="section" value="<?php echo $_SESSION['section1'] ;?>"></td>
</tr>
<tr>
    <td>
        <input type="submit" value="UPDATE" name="update1" >
    </td>
</tr>
</table>
</form>
<?php
    if(isset($_POST['update1'])){
        $class_name = $_POST['class_name'];
        $section = $_POST['section'];
        update_data($_SESSION['idi'],$_POST['class_name'],$_POST['section']);
        echo 'did='.$_SESSION['idi'].' class1='.$_SESSION['class1'].' section1='.$_SESSION['section1'].'<br>';
    }

function update_data($id1,$class1,$section1)
    {
        echo'suresh <br>';
        echo $id1.' '.$class1.' '.$section1.'<br>';
        $dbc = mysqli_connect('localhost','root','','cce')
                    or die('Error connecting to MySQL server');

        $query = "SELECT * FROM class";
        $result = mysqli_query($dbc,$query)
                    or die("Error connecting to database1");

        //while($row = mysqli_fetch_array($result))
        //{
            echo'TEST<br>';
            $query="UPDATE class SET class_name='".$class1."', class_section='".$section1."' WHERE id = '".$id1."'";
            $result = mysqli_query($dbc,$query)
                    or die("Error connecting to database2");
            echo'TEST2<br>';
        //}
        mysqli_close($dbc); 
    }
?>
</body>
</html>

The problem is each time I submit the form, I am expecting to see the same session value printed out. BUT as soon as I hit submit, the value disappears and prints nothing... However IF I MAKE action="" in the form THEN each time I submit the form the value of $_SESSION['abc'] is still the same, 99.

Neden bu? $_SERVER['PHP_SELF'] oturumu sıfırlamak mı? Ya da konfigürasyonda bir şey mi?

0 Cevap