Voy avanzando poco a poco en Ajax gracias a FDW.
Bueno, ahora, mi problema, quiero pasar el valor de un textarea por Ajax + PHP
El ajax
Cita:
El PHPfunction itemEdit(id,name,weight,atk,def,slots,desc){
var answer = confirm("Confirm you want to edit the selected item")
if (answer){
ajaxXML=GetXmlHttpObject();
var url = "item_edit.php?item_id="+id+"&name="+name+"&weight ="+weight+"&attack="+atk+"&defence="+def+"&slots=" +slots+"&description="+desc;
/*location.href=url;*/
ajaxXML.onreadystatechange=errorState;
ajaxXML.open("GET",url,true);
ajaxXML.send(null);
}
}
var answer = confirm("Confirm you want to edit the selected item")
if (answer){
ajaxXML=GetXmlHttpObject();
var url = "item_edit.php?item_id="+id+"&name="+name+"&weight ="+weight+"&attack="+atk+"&defence="+def+"&slots=" +slots+"&description="+desc;
/*location.href=url;*/
ajaxXML.onreadystatechange=errorState;
ajaxXML.open("GET",url,true);
ajaxXML.send(null);
}
}
Cita:
Bueno, parece que soy un poco redudante. Pregunto y a los 2min tengo la solucion.. Les dejo en ejemplo y el error:<?php
include '../adodb/adodb.inc.php';
include '../site/config.ini.php';
include '../lib/functions.php';
checkadmin();
$db = ADONewConnection('mysql');
$db -> Connect($roforever['server'], $roforever['username'], $roforever['password'], $roforever['database']);
$query=$db->Execute("UPDATE `item_db` SET `weight` = '".$_GET[weight]."', `attack` = '".$_GET[attack]."', `defence` = '".$_GET[defence]."', `slots` = '".$_GET[slots]."', `description` = '".$_GET[description]."' WHERE `id`='".$_GET[item_id]."' LIMIT 1");
?>
include '../adodb/adodb.inc.php';
include '../site/config.ini.php';
include '../lib/functions.php';
checkadmin();
$db = ADONewConnection('mysql');
$db -> Connect($roforever['server'], $roforever['username'], $roforever['password'], $roforever['database']);
$query=$db->Execute("UPDATE `item_db` SET `weight` = '".$_GET[weight]."', `attack` = '".$_GET[attack]."', `defence` = '".$_GET[defence]."', `slots` = '".$_GET[slots]."', `description` = '".$_GET[description]."' WHERE `id`='".$_GET[item_id]."' LIMIT 1");
?>
Cita:
Me olvide los .value!!!! <li onClick="itemEdit(<?=$row[id];?>,''+name_<?=$row[id];?>.value+'',''+weight_<?=$row[id];?>.value+'',''+atk_<?=$row[id];?>.value+'',''+def_<?=$row[id];?>.value+'',''+slots_<?=$row[id];?>.value+'',''+desc_<?=$row[id];?>.value+'');">Edit</li>