Visualizzazione dei risultati da 1 a 2 su 2
  1. #1

    Problema urgente con submit ajax

    Mi spiegate perchè questo c***o di script non funziona !!!!!!!!!!!!!!!!!!!!!!!!!!
    codice:
    function submit(FILE, METHOD){
    
    	var url;
    	var parameters;
    	var target = "target";
    	
    	elements = document.forms[0].elements;
    	num = document.forms[0].elements.length;
    	for(i = 0; i < num; i++){
    		type = elements[i].type;
    		if(((type == "text") || (type == "hidden") || (type == "password")) && (elements[i].checked)){
    			value = child.value;
    			name = child.name;
    			parameters += name + "=" + value + "&";
    		}
    	}
    	if((METHOD == "POST") || (METHOD == "post")){
    		ahah(FILE, target, METHOD, parameters)
    	}
    	if((METHOD == "GET") || (METHOD == "get")){
    		url = FILE + "?" + parameters;
    		ahah(url, target, METHOD);
    	}
    }
    Il form che gestisce è il seguente :
    codice:
    <form action="javascript:submit('gallery.php', 'get');">
    	<input type="text" name="url" />
    	<input type="submit" value="Aggiungi foto" />
    </form>
    il codice di gallery.php è il seguente :
    codice:
    <?php
    	$url = $_GET["url"];
    	$img = "<img src=\"$url\" height=\"300\" width=\"400\" />";
    	echo $img;
    ?>
    Che c'è che non va ??????????????????????????
    Il debug mi da GET http://localhost/gallery.php?undefined
    non ci capisco più niente,
    per favore aiutatemi

  2. #2
    Risolto :
    bastava togliere il controllo su checked

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.