Oppure

Loading
30/03/11 7:02
KleeToride
Salve, ho la necessità di cambiare lo stato a sei input type text. Prima mi serviva cambiare il loro stato da disabled=true a false alla spunta di un check.

Dopo di che ho trovato difficoltà quando ho provato ad inviare i valori al database. Se gli input type text sono settati su disabled=true nella fase di "POST" non esistono e quindi non sono giustificate le variabili per l'insert nel database. Come posso fare?


<script type="text/javascript">
function controlla(){
    for(i=1;i<7;i++){
        if (document.getElementById("checkbox").checked==false) {
	    document.getElementById("text"+i).disabled=true;} else {
	    document.getElementById("text"+i).disabled=false;}
	}   
    setTimeout("controlla()",500);}
controlla();
</script>


PS : oppure devo fare un altro tipo di controllo in database :


   if(isset($_POST['text1'])){
    $text1 = addslashes(filter_var($_POST['text1'], FILTER_SANITIZE_STRING));
 }
    if(isset($_POST['text2']){
    $text2 = addslashes(filter_var($_POST['text2'], FILTER_SANITIZE_STRING));
 }
    if(isset($_POST['text3'])){
    $text3 = addslashes(filter_var($_POST['text3'], FILTER_SANITIZE_STRING));
 }
    if(isset($_POST['text4'])){
    $text4 = addslashes(filter_var($_POST['text4'], FILTER_SANITIZE_STRING));
 }
    if(isset($_POST['text5'])){
    $text5 = addslashes(filter_var($_POST['text5'], FILTER_SANITIZE_STRING));
 }
    if(isset($_POST['text6'])){
    $text6 = addslashes(filter_var($_POST['text6'], FILTER_SANITIZE_STRING));
 }


Ringrazio in anticipo :D!
aaa