I'm using PHP and MySQL. I am trying to insert form data from a web page to a MySQL database using a PHP function.
This is the code of the user form page:
<?php
include 'core/int.php';
include 'includes/overall/header.php';
if(!empty($_POST)){
$add_status = $insert->add_status($user_data['user_id'], $_POST);
}
?>
<form action = "" method = "POST">
<ul>
<li>
<input name = "question_time" type = "hidden" value = "<?php echo time()?>" />
</li>
<li>
<h2>Post your Question <?php echo $user_data['username'];?></h2>
<textarea name = "question"></textarea>
</li>
<li>
<p><input type = "submit" value = "submit"></p>
</li>
</ul>
</form>
and this is the function 'add_status' i am defining on another page..
function add_status($user_id, $_POST){
mysqli_query("INSERT into `post` (user_id, status_time, status_content) VALUES($user_id, '$_POST[question_time]', '$_POST[question]')");
}
When this runs on localhost it throws an error:
Cannot re-assign auto-global variable _POST in C:\wamp\www\zr\core\functions\users.php on line 97
I see that Line 97 is function add_status()
What does the error mean and how do I fix it?