0
echo ("<tr bgcolor='B0C4DE'>"); 

$value=$row['idbook_code'];
$author=$row['b_author'];
$book=$row['b_name'];
		echo ('ISBN :     '.$row['idbook_code'].'<br/>');
		echo ('Title :    '.$row['b_name'].'<br/>');
		echo ('Author :   '.$row['b_author'].'<br/>');
		echo ('Books Available  :  '.$row['b_avail'].'<br/>');
	
		if($row['b_avail']>0)
		{
				if (!$_SESSION["valid_user"])
        {
        // User not logged in, redirect to login page
		echo("Available".'<br/>');
		}else
		{
       echo("<input type='hidden' name='idbook' value='$value'>");
	   echo("<input type='hidden' name='author' value='$author'>");
	   echo("<input type='hidden' name='book' value='$book'>");
?>
	   
<input type='submit' name='submitbutton' value='Add to Cart' onsubmit='submitPressed()' ><br/>
<?php
		}
		
		}else
	
		echo("No stock of book".'<br/>');
		
		echo("</tr>".'<br/>');
		echo("<tr>");echo("==============");echo("</tr>".'<br/>');
		
		?>

how can i disable a button is clicked

4
Contributors
13
Replies
14
Views
6 Years
Discussion Span
Last Post by yamot47
0

Use javascript

Use onclick attribute or an event handler.

0

Use javascript

Use onclick attribute or an event handler.

can you give me an idea

0

OK, I assume you're submitting via ajax? If not you don't need to disable do you?


THis is the only form button/submit that you have:

<input type='submit' name='submitbutton' value='Add to Cart' onsubmit='submitPressed()' ><br/>

Which buttons do you need to disable? Which event causes disable. When should they/it be enabled again?

I need more info.

0

what if the button is dynamic??? can you tell me what should i do???

0

OK, I assume you're submitting via ajax? If not you don't need to disable do you?


THis is the only form button/submit that you have:

<input type='submit' name='submitbutton' value='Add to Cart' onsubmit='submitPressed()' ><br/>

Which buttons do you need to disable? Which event causes disable. When should they/it be enabled again?

I need more info.

button is disable when click as you can see the button is echo equal to item that been search so the button will show 5 or more button my problem is i need to disable button when clicked

0

If the button is produced by php - no problem as it is created before js gets a grip on anything.Have you tried it? Look, give things a go, and come back with some code (new stuff).

0

When you retrieve b_avail and create the button, set the rules the if the book is unavailable, button is disabled.

0

When you retrieve b_avail and create the button, set the rules the if the book is unavailable, button is disabled.

i know that... the problem is to avoid multiple sumbitting

0

for that I thought wcordio had provided the solution?

try:

<input type='submit' name='submitbutton' value='Add to Cart' onclick='this.disabled=true'><br/>
<input type='submit' name='submitbutton' value='Add to Cart' onclick='this.disabled=true'><br/>
<input type='submit' name='submitbutton' value='Add to Cart' onclick='this.disabled=true'><br/>
<input type='submit' name='submitbutton' value='Add to Cart' onclick='this.disabled=true'><br/>
0

for that I thought wcordio had provided the solution?

try:

<input type='submit' name='submitbutton' value='Add to Cart' onclick='this.disabled=true'><br/>
<input type='submit' name='submitbutton' value='Add to Cart' onclick='this.disabled=true'><br/>
<input type='submit' name='submitbutton' value='Add to Cart' onclick='this.disabled=true'><br/>
<input type='submit' name='submitbutton' value='Add to Cart' onclick='this.disabled=true'><br/>

the code is working when i change the submit to button but when i click the next page the disabled button is back to enable how can i get that work??? that even i change page it's still disabled

0

back to my first reply, when you're at the new page, you should disable those buttons when the query for b_avail is false.

0

back to my first reply, when you're at the new page, you should disable those buttons when the query for b_avail is false.

i dont get your idea sir can you tell me how to do it ???

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.