-1

here is my php. the session ps comes from a another php page. it comes successfully. but i am getting undefined when i try to use it on the following code to connect to my db.

    <?php
$pss = "";
session_start();
if(isset($_SESSION['ps'])){
    $pss = $_SESSION['ps'];
}

echo $pss;
$connect = mysqli_connect("localhost","root","","erthiph_asksheikh851821217");

mysqli_query($connect,"INSERT INTO `as_questions`(`Qid`, `M_class`, `S_class`, `Question`, `Answer`, `Doctor`, `Time`) VALUES
('','','','".$pss."','','',CURRENT_TIMESTAMP)");
?>

the above code works. i replaced '$_POST[postquestion]' with '".@pss."' please check edit history to check edits.

Mohamed Athif
  • 458
  • 1
  • 6
  • 18

1 Answers1

2

change '$_POST[$pss]' to '".$pss."'

Anant Kumar Singh
  • 68,309
  • 10
  • 50
  • 94
Olbrych
  • 124
  • 1
  • 8