Page 1 of 1

Button Code Help Needed Please

Posted: Thu Sep 24, 2009 4:13 pm
by synical21
Ok heres the deal lads on my website i have button and what i need to do is, when the button is clicked i need it to disappear and a new image to replace it or another button which cant be clicked. This is vital as this button changes user money values and obviously can not be clicked twice. Here is the basic button:

Code: Select all

"<td width='10%' align='center'><a href='proofprocess.php?id=$userproof_id'><img src ='images/tick.png'></img></a></td>\n";
Any help much apreciated.

Re: Button Code Help Needed Please

Posted: Thu Sep 24, 2009 5:14 pm
by jackpf
Why not just do this?

Code: Select all

<input type="submit" onclick="this.disabled = true;" />

Re: Button Code Help Needed Please

Posted: Sat Sep 26, 2009 7:50 am
by synical21
I never knew i could do that for a table i only used that for forms so your saying put something like

Code: Select all

echo "<td width='5%' align='center'><input type='submit' onclick='this.disabled = true'></td>\n";
Only problem is i never used the input type submit function like that so how would i make it link to: proofprocess.php?id=$userproof_id

Sorry it took long to reply i had an unexpected trip to the hospital.

Re: Button Code Help Needed Please

Posted: Sat Sep 26, 2009 9:10 am
by jackpf
Oh right, sorry. Didn't realise you weren't using a form.

Try this:

Code: Select all

<form action="proofprocess.php?id=$userproof_id" method="post"><input type="image" src="images/tick.png" onclick="this.disabled = true;" /></form>
Sorry it took long to reply i had an unexpected trip to the hospital.
Hope everything's ok ;)

Re: Button Code Help Needed Please

Posted: Sat Sep 26, 2009 9:47 am
by synical21
I still dont understand how i can put that form information into the table when the table is done in php tags, let me show you a section of the page im talking about

Section Screenshot:
http://img225.imageshack.us/img225/5531/samplez.png

When a user clicks tick its got to do a process of MySQL commands which change money amounts, the page this is done at is proofprocess.php. The only way i thought of doing it is by linking the button to the page with href but this isnt practical at all as it changes the page and allows the link to be clicked multiple times. So i need a way to solve this, i have been stuck on it for a very long time now.

Re: Button Code Help Needed Please

Posted: Sat Sep 26, 2009 11:08 am
by jackpf
I don't understand what you mean. Just try it and see!

You obviously need to echo the $userproof_id at the end of the form action. You can do that one of multiple ways - opening a PHP tag and echoing, or echo the whole form and concatenate the $userproof_id.

Like:

Code: Select all

echo '<form action="proofprocess.php?id='.$userproof_id.'......';
//or
<form action="proofprocess.php?id=<?php echo $userproof_id;?>.....