Buon giorno, invio i dati da index.php tramite $_POST, a save.php in questo modo:
//index.php
//save.phpcodice:<?php $sql = ("Select MAX(nIdNews) as last_id from TBANNEW") or die ("Impossibile eseguire la select MAX - riga 295"); $rsMAX= mysql_query($sql) or die ("Impossibile connettersi!" . mysql_error()); if ($MyError == "") { if (nNumRows($rsMAX) > 0) { $last_id = $cRiga['last_id']+1; } } $arr = array(0, 1, 2, 3, 4, 5, 6, 7); reset ($arr); echo "<select name='NuovaPosizioneNews[$last_id]'>"; foreach ($arr as $value) { echo " <option value='$value'>$value</option>"; } echo "</select>"; ?>
Vorrei sapere per favore, come posso prendere i valori dall'array $_POST singolarmente al di fuori del foreach..cosi da poterli trattare separati.codice:$arrayNewPost = $_POST['NuovaPosizioneNews']; $arrayNewPost = $_POST['NuovaPosizioneNews']; if($arrayNewPost!=NULL){ //$ris = ''; foreach($arrayNewPost as $key => $value) { //$ris .= $key." => ".$value.","; $sql = ("update tbannew set PosizioneNews = '$value' where nIdNews = '$key'") or die ("Impossibile eseguire l’ update della tbannew"); echo $sql . " "; } /*$ris = substr($ris, 0, -1); echo "Ris: " . $ris;*/ }
Grazie mille e buona giornata....

Rispondi quotando