<?php
$pdo = new PDO("mysql:host=extoleducation.ipagemysql.com;dbname=trialdb","username","password");
if(isset($_POST['sample1'])) {
$sql = "INSERT INTO `sampletable` (`sampleline`) VALUES (:sample1)";
$query = $pdo->prepare($sql);
# I find binding values much easier just doing the array into the execute
# If you get it working like this and really want to go back and try
# bindValue(), you can
$query->execute(array(':sample1'=>$_POST['sample1']));
}

This is as basic as it gets. If you can get this to work, then you just kind of build off of it. You may want to try/catchPDOExceptions if you want to troubleshoot any unforeseen sql errors.

For testing pursposes, I would be tempted to not send json, that way you can more-easily troubleshoot your php from the console.log():

$(document).ready(function(){
$("#sendit").on("click", function() {
// If you are not serializing, I would do an object, not array
var fieldvalue = {"action":"submit"};
// Loop through and save names and values
$('#maindiv input').each(function(k,v) {
fieldvalue[$(v).attr('name')] = $(v).val();
});
$.ajax({
url: "sample2.php",
type: "POST",
// Try just sending array here
data: fieldvalue,
// On the success, add the response so you can see
// what you get back from the page
success: function(response) {
// Do a check to see if you get any errors back
console.log(response);
// This has minimal value because it is only telling you
// that the ajax worked. It's not telling you anything from the
// response of the page
alert("worked");
}
});
});
});