Jump to content

submit and disable button


pacome

Recommended Posts

Hi... I'm trying to get this working but no luck.

The idea is: someone selects a button which has a value, this value is sent to the server, and for a random period of time this button cannot be selected anymore...

 

I've got the following code, but it either sends the value or dsabls the button, and I can't seem to get both things done... any ideas please????

 

//javascript

 

function dsabl(button){

var Rand = Math.random();

var escalaRand = Rand*10000;

var button;

var origvalue=button.value;

button.disabled=true;

button.value='ocupado'

setTimeout(function(){button.disabled=false;button.value=origvalue},escalaRand);

}

 

//html

 

<form action="simulador.php" name="simulador" method="get"><table><tr><td>

<input type='submit' id='350' name='submit' value='350' class="imgBotonFinger" onclick="dsabl(this)"></td>

<input type='submit' id='button' name='button' value='352' class="imgBotonFinger" onclick='javascript:dsabl(button)'></td>

<input type='submit' id='354' name='submit' value='354' class="imgBotonFinger" onclick="dsabl(this)"></td>

<input type='submit' id='356' name='submit' value='356' class="imgBotonFinger" onmouseup="dsabl(this)"></td></tr>

</table>

</form>

 

//Php

 

$conTYP = mysql_connect ('$host','$user','$pass') or die ("no conn");

@mysql_select_db ('aerosim') or die ("hey somth wrongsing");

$sqlTYP = "SELECT * FROM vuelos WHERE claseAvo >= '3' ORDER BY RAND() LIMIT 1";

$displayTYP = mysql_query ($sqlTYP) or die ('query again');

mysql_query ($sqlTYP) or die (mysql_error ($conTYP));

while ($rowTYP = mysql_fetch_assoc($displayTYP)) {

$tipoAvo = $rowTYP["tipoAvo"];

$claseAvo = $rowTYP["claseAvo"];

$callsign = $rowTYP["callsign"];

$orgn = $rowTYP["orgn"];

$dest = $rowTYP["dest"];

$comentario = $rowTYP["comentario"];

$restricciones = $rowTYP["restricciones"];

 

}

$conSTAND = mysql_connect ('$host','$user','$pass') or die ("no conn");

@mysql_select_db ('aerosim') or die ("hey somth wrong");

$sqlSTAND = "SELECT * FROM terminal4 WHERE stand = '$_GET[submit]'";

$displaySTAND = mysql_query ($sqlSTAND) or die ('query wrong');

mysql_query ($sqlSTAND) or die (mysql_error ($conSTAND));

while ($rowSTAND = mysql_fetch_assoc($displaySTAND)) {

$_claseAvo =$rowSTAND["claseAvo"];

$_coment = $rowSTAND["coment"];

$_stand =$rowSTAND["stand"];

$_gateF =$rowSTAND["gateF"];

$_gateR =$rowSTAND["gateR"];

$_tipoMin =$rowSTAND["tipoMin"];

$_tipoMax =$rowSTAND["tipoMax"];

$_tipoTraf =$rowSTAND["tipoTraf"];

$_restricc =$rowSTAND["restricc"];

 

}

 

 

 

I aprecciate any help!

 

Link to comment
https://forums.phpfreaks.com/topic/96742-submit-and-disable-button/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.