I would make VarData
an object, to make the encoding operations easier:
var VarData={studentName: student_name, studentContact: student_contact, studentEmail: student_email, right: right};
Then in your php code you shoudl be able to easily get the variables from $_POST
:
$student_name=$_POST['studentName'];
$student_contact=$_POST['studentContact'];
$student_email=$_POST['studentEmail'];
$right=$_POST['right'];
Please note that $_POST
is a php global variable created by the web server into the Php context and it contains the data submitted in a HTTP POST request. The variable is an array, having as keys the HTTP POST field names and as values the field values. As such, accessing this as $_POST['#right']
makes no sense, as there is not field called #right
. What also doesn't make sense, as this is not jQuery, is the calll to $_POST['#right'].html()
- there is no object method called .html()
on arrays because a) they are not objects b) arrays don't necessaily contain html code, they are general language constructs.
The most likely reason why your code doesn't work is that because the content of your div is not url-encoded in the VarData
string. Making VarData
an object removes the need for you to encode data.