Below is a function called add_total(); which i use to save typed input fields user id, name, total and date in a form to save them in my database and works 100%.
but how can i save values in a input field which are default values such as value="1500" and value="<?php echo $_GET['total'] ?>" to my database?
<input type="text" value="1500" name="total" >
<input type="text" value="<?php echo $_GET['total'] ?>" name="total" >
every time i submit such input fields my database records 0. please help! and by the way i am still new to php html and javascript.
What I have tried:
function Add_total()
{
$user_id = $_POST['user_id'];
$name = $_POST['name'];
$total = $_POST['total'];
$date = date('Y-m-d h:i:s');
$sql=sprintf("INSERT INTO `users`(`user_id`, `name`, `total`, `status`, `date`) VALUES ('$user_id','$name','$total','0','$date')");
$rs=mysqli_query($this->connection_to_database,$sql) or die(mysqli_error());
return true;
return false;
}</pre>