This is fragment of my code:
<?php
session_start();
$_SESSION['counter']=0;
if(isset($_POST['id'])){
$id = $_POST['id'];
$id = strval($id);
@$_SESSION['order'] +=',';
@$_SESSION['order'] +=strval($id);
echo $_SESSION['order'];
$_SESSION['counter']+=1;
}
echo '<br>'.$_SESSION['counter'];
?>
and when I open up the page, I see this error
"Fatal error: Uncaught TypeError: Unsupported operand types: null + string in C:\xampp\htdocs\pizza\index.php:7 Stack trace: #0 {main} thrown in C:\xampp\htdocs\pizza\index.php on line 7"
Please help me repair this quickly, because I have to hand my project on until March 1st.
This code should import the data from $_POST['id']
to $id
and add this to $_SESSION['order']
with the ","
character. I tried to parse $id to string, but it seems like, it doesn't work.