Problem in inserting partial data from dropdown to mysql using PHP

  You are currently not logged in. You can view the forums, but cannot post messages. Log In | Register

17-Sep-17 04:43
I have an issue to insert data from dropdown to mysql.
It is inserting the partial data to database
Example: if selection is Account Dept, but inserted only Account. missing Dept
if selection is Non Active, inserted only Non. missing Active.
whatever coming after space, it cannot be inserted. It happens only in dropdown control.

In Database, using varchar(30) for column

Pls advice where I did wrong.
Thank you

Here is my HTML code

<select class="form-control" data-placeholder="Choose a Category" name="status">
$sql = "select * from tbl_parameter where paramhead ='STATUS' order by paramdetails";
$stmt = $pdo->prepare($sql);
while ($row = $stmt->fetch())
$optvalue = $row['paramdetails'];
print '<option value ='.$optvalue.'>' .$row['paramdetails']. '</option>';



php code

$staffid =$_POST['staffid'];
$staffname =$_POST['staffname'];
$gender =$_POST['gender'];
$time = strftime("%X");
$date = strftime("%B %d,%Y");
$createdon = date("Y-m-d H:i:s");

$bool = true;
$sql="insert into tbl_staff_master(staffid,staffname,gender,department,emailid,hpno,address,city,state,country,status,createdby,createdon,terminal)
values ('$staffid','$staffname','$gender','$department','$emailid','$hpno','$address','$city','$state','$country','$status','$createdby','$createdon','$terminal')";
$pdo = null;
print '<script>alert("Saved");</script>';
19-Sep-17 07:11
A space character is a delimiter for HTTP form data so you need to URL Encode the data before sending it.

So long, and thanks for all the fish.

New posts
Old posts

Follow Elated