Button Code Help Needed Please

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
synical21
Forum Contributor
Posts: 150
Joined: Tue Jul 28, 2009 8:44 am
Location: London UK

Button Code Help Needed Please

Post 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.
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: Button Code Help Needed Please

Post by jackpf »

Why not just do this?

Code: Select all

<input type="submit" onclick="this.disabled = true;" />
synical21
Forum Contributor
Posts: 150
Joined: Tue Jul 28, 2009 8:44 am
Location: London UK

Re: Button Code Help Needed Please

Post 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.
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: Button Code Help Needed Please

Post 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 ;)
synical21
Forum Contributor
Posts: 150
Joined: Tue Jul 28, 2009 8:44 am
Location: London UK

Re: Button Code Help Needed Please

Post 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.
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: Button Code Help Needed Please

Post 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;?>.....
 
Post Reply