Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP: special character as key in array
    primarykey
    data
    text
    <p>my problem is that i use the special character <strong>&amp;</strong> as an key and this seems not to work</p> <p>my array is like this</p> <pre><code>$legalforms = array( 'GmbH &amp; Co.KG' =&gt; array( 'namesToSubmit' =&gt;array( 'companyName'=&gt;'required', 'location'=&gt;'required', 'phone'=&gt;null, 'fax'=&gt;null, 'web'=&gt;null, 'registryCourt'=&gt;'required', 'registryNumber'=&gt;'required', 'companyNameAssociate'=&gt;'required', 'locationAssociate'=&gt;'required', 'registryCourtAssociate'=&gt;'required', 'registryNumberAssociate'=&gt;'requuired', 'ceo'=&gt;'required' ), ) ) </code></pre> <p>and when i want to use the namesToSubmit i get an error that property of nameToSubmit is null, if i remove the special character <strong>&amp;</strong> out of it , it works.. so how can i get it to work with the <strong>&amp;</strong> ?</p> <p>edit:</p> <pre><code>$("#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&lt;data.textfieldHeaders.length; i++){ fields.push(data.textfieldHeaders[i],'&lt;br&gt;','&lt;input name="',fieldnames[i],'" type="text" ',data.namesToSubmit[fieldnames[i]] == "required"?"required":"",'&gt;','&lt;br/&gt;'); } fields.push("&lt;br&gt;", 'Pflichtfelder (*)'); $("#fieldsForm").prepend(fields.join('')); }, error: function(jqXHR,textStatus,errorThrown){ console.log(jqXHR); console.log(textStatus); console.log(errorThrown); } }); }); </code></pre> <p>and i get the error in this line </p> <pre><code>for(property in data.namesToSubmit){ </code></pre> <p>tried the md5 , didn´t work , but thanks for all your help</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload