-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
  • 468
  • 2
  • 6
  • 19

1 Answers1

2

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

Alive to die - Anant
  • 70,531
  • 10
  • 51
  • 98
Olbrych
  • 124
  • 1
  • 8