Damuslo Damuslo - 6 months ago 20
SQL Question

Save Description using textarea in mysql with php

enter image description herecan anybody help me how to save text in my text area in MySQL and view it into another page.[![enter image description here][2]][2]

and this is my code:

if(isset($_POST['add']))
{
if(empty($_POST['position'])) {
echo '<script> alert("position is required!"); </script>';
}
else
{
$position = test_input($_POST["position"]);
$description = $_POST["description"];
$sql= "insert into tbl_jobdescription(position,description) values ('$position','$description')";
$result = mysqli_query($conn,$sql)or die(mysqli_error());

if($result) {
echo '<script> alert("Successfully add admin account."); </script>';
$position = $description = "";
}
}
}


enter image description here

Answer

You need to add the connection in the mysqli_error() function as a parameter See here

Comments