Foro de elhacker.net

Programación => PHP => Mensaje iniciado por: glcc11 en 10 Junio 2013, 02:45 am



Título: Ejecutar accion sin reiniciar página
Publicado por: glcc11 en 10 Junio 2013, 02:45 am
Lo que quiero hacer es lo siguente:
Yo tengo una accion en mi documento de php llamada: case1
<?php

if (isset($_GET['subAction']) == "change")
{
$ID = $_GET['ID'];
$uris = $row_Cuenta['uridium'];
$cred = $row_Cuenta['creditos'];
$gfx = $row_Cuenta['gfx'];
$vel = $row_Cuenta['vel'];
$g_vel = $row_Cuenta['g_vel'];
$escudo = $row_Cuenta['escudo'];
$hp = $row_Cuenta['hp'];
$des = $row_Cuenta['des'];
$br = $row_Cuenta['bono_reparacion'];

switch($ID)
{
case 1:
$gfx =($row_Cuenta['gfx']);
$des =($row_Cuenta['des']);
$VENGEANCE = $gfx=8 ;
$tradeGFX = "$VENGEANCE";
$precio = $cred - 0;
$nave = $nave = 8;
$hp = $hp = 180000;
$hpMax = $hpMax = 180000;
$vel = $vel = 380;
$cargaMax = $cargaMax = 1000;
$escudo = $escudo + 0;
if($des[7] =0)
{
echo "<script>alert('ˇNo se puede usar esta nave por que no la has comprado todavĂ­a!');</script>";
}else{
$updateGFX = sprintf("UPDATE cuentas SET creditos=%s,nave=%s,hp=%s,hpMax=%s,vel=%… WHERE id=%s",
GetSQLValueString($precio, "int"),
GetSQLValueString($nave, "int"),
GetSQLValueString($hp, "int"),
GetSQLValueString($hpMax, "int"),
GetSQLValueString($vel, "int"),
GetSQLValueString($cargaMax, "int"),
GetSQLValueString($escudo, "int"),
GetSQLValueString($precio, "int"),
GetSQLValueString($tradeGFX, "text"),
GetSQLValueString($row_Cuenta['id'], "int"));
mysql_query($updateGFX, $DO) or die(mysql_error());
}
break;


}
//echo "<script>alert('Se han añadido $MAX cantidades.')</script>";
}

?>
quiero hacer un boton para que cuando le de al boton se ejecute la accion llamada case 1


Título: Re: Ejecutar accion sin reiniciar página
Publicado por: engel lex en 10 Junio 2013, 06:05 am
javascript, busca sobre ajax (con jquery es lo mas facil)