my problem is that i use the special character & as an key and this seems not to work
my array is like this
$legalforms = array(
'GmbH & Co.KG' => array(
'namesToSubmit' =>array(
'companyName'=>'required',
'location'=>'required',
'phone'=>null,
'fax'=>null,
'web'=>null,
'registryCourt'=>'required',
'registryNumber'=>'required',
'companyNameAssociate'=>'required',
'locationAssociate'=>'required',
'registryCourtAssociate'=>'required',
'registryNumberAssociate'=>'requuired',
'ceo'=>'required'
),
)
)
and when i want to use the namesToSubmit i get an error that property of nameToSubmit is null, if i remove the special character & out of it , it works.. so how can i get it to work with the & ?
edit:
$("#sendLegalForm").click(function () {
selection = $('#selection').val();
$.ajax({
type:'GET',
url:'http://192.168.10.24/php/sig.php?selectedLegalform='+ selection,
dataType:'json',
success: function (data){
$("#legalform").hide();
$("#fields").show();
var fieldnames =[];
for(property in data.namesToSubmit){
fieldnames.push(property);
}
var fields=[];
for(var i=0; i<data.textfieldHeaders.length; i++){
fields.push(data.textfieldHeaders[i],'<br>','<input name="',fieldnames[i],'" type="text" ',data.namesToSubmit[fieldnames[i]] == "required"?"required":"",'>','<br/>');
}
fields.push("<br>", 'Pflichtfelder (*)');
$("#fieldsForm").prepend(fields.join(''));
},
error: function(jqXHR,textStatus,errorThrown){
console.log(jqXHR);
console.log(textStatus);
console.log(errorThrown);
}
});
});
and i get the error in this line
for(property in data.namesToSubmit){
tried the md5 , didn´t work , but thanks for all your help