Salve,
ho questo script che mi estrae l'array con i dati di un form salvato nel db:
il problema è che mi da sempre nessun form inviato! anche se INCOLLANDO COME HO FATTO SOPRA LA STRINGA presa dal DB me lo riconosce come array valido!Codice PHP:<? $array = trim(stripslashes(@unserialize($rows['array_fields'])));
if(isset($array) && is_array($array)){
unset($array["anno"]);
unset($array["modello"]);
unset($array["marca"]);
unset($array["prezzovendita"]);
unset($array["prezzovenditarev"]);
unset($array["prezzovenditarev"]);
unset($array["prezzonuova"]);
unset($array["isvendo"]);
unset($array["date_last_modified"]);
unset($array["date"]);
/* $catname = $objects->extractNamesEnglishForms($rows['catid']);
$catname = substr($catname, 0, -1);
$catname = explode(",",$catname);
$lunghezzaArray = count($sectors);
*/
unset($array["catid"]);
unset($array["prezzoacquisto"]);
unset($array["features"]);
unset($array["ID"]);
unset($array["nomesect"]);
unset($array["mcategory"]);
unset($array["sendBtn"]);
unset($array["Resa"]);
unset($array["settore"]);
unset($array["settoreex"]);
unset($array["settoreexname"]);
unset($array["settorename"]);
unset($array["descrizione"]);
unset($array["condizione"]);
unset($array["Submit"]);
global $key,$value;
foreach ($array as $key => $value) {
$key = trim(addslashes($key));
$keyen = trim(addslashes($key));
$keylabel = str_replace("_"," ",$key);
$keyarray = explode("+",$key);
$keylabel = $keyarray[0];
$keylabelen = $keyarray[1];
if($_COOKIE['RGP-language']=="it" OR $_COOKIE['RGP-language']==""){
$keylabel = str_replace("_"," ",$keylabel);
echo "<tr width='100%'><td width='80%' align=\"left\" valign=\"top\"><div align=\"left\">[b]$keylabel[/b]</div></td> <td width='20%' align=\"left\" valign=\"top\"><div align=\"left\"><input type=text size='12' name=$key value=$value></div></td></tr>";
}else{ $keylabelen = str_replace("_"," ",$keylabelen);
echo "<tr width='100%'><td width='80%' align=\"left\" valign=\"top\"><div align=\"left\">[b]$keylabelen[/b]</div></td> <td width='20%' align=\"left\" valign=\"top\"><div align=\"left\"><input type=text size='12' name=$key value=$value></div></td></tr>";}
}
}
else{
echo "nessun form inviato!";
//qui faccio la prova direttamente sulla stringa che è salvata nel db!
$array = unserialize('a:10:{s:9:"mcategory";s:6:"MULLER";s:2:"ID";s:3:"142";s:7:"modello";s:3:"eee";s:5:"marca";s:0:"";s:4:"anno";s:0:"";s:13:"campè+cddddd";s:0:"";s:13:"fieldè+field";s:0:"";s:14:"prezzoacquisto";s:0:"";s:11:"descrizione";s:0:"";s:7:"sendBtn";s:4:"SEND";}');
echo print_r($array);
if(is_array($array)){ echo "è array----";
}
} ?>
dipende dal fatto che sono presenti dei caratteri accentati nella stringa serializzata?
Qualche idea?
Grazie

Rispondi quotando