I have a couple of radio fields and an input text type field on my form:
<input name="cbPerson" type="radio" value="1" checked/>Person1
<input name="cbPerson" type="radio" value="2"/>Person2
<input name="txtName" type="text" />
I am serializing my form this way:
$.ajax({
type: 'post',
url: 'form-1-proc.php',
data: $('form').serialize(),
success: function (data) {
alert(data);
},
error: function () {
alert('error');
}
});
And I am getting the data on server side (form-1-proc.php
) this way:
$person = $_POST['cbPerson'];
$name = $_POST['txtName'];
The variable $person
has an expected value, but the variable $name
never brings a value and it is always "0".
This page is worked as a separate page on Joomla driven website btw, the page itself is on the root of the site so doesn't mess up with Joomla routing and stuff.
Can you please tell me how can I get the data from the input text fields?. Both have a name
attribute and on the client it holds a value if i output the value of serialize function thru console or an alert with javascript.
Thank you.