help with onclick and php

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
php_postgresql
Forum Newbie
Posts: 13
Joined: Sat Apr 19, 2008 9:37 am

help with onclick and php

Post by php_postgresql »

~pickle | Please use [ code=html ], [ code=php ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: :arrow: Posting Code in the Forums to learn how to do it too.


my code here works..but the query doesnt..........
the alert happens but the query wont work..

Code: Select all

 
<form>
            <input type=button value="Approve"
            onClick="if(confirm('Are you sure you want to approve?'))
            {   <?php $queryupdate;    ?>
                alert ('Registration has been approved.');
                window.location='main.php'
            }
            else
            {   
                alert ('Hindi inapprove.');
                window.location='home.php'
            }"          >
        </form>

~pickle | Please use [ code=html ], [ code=php ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: :arrow: Posting Code in the Forums to learn how to do it too.
User avatar
aceconcepts
DevNet Resident
Posts: 1424
Joined: Mon Feb 06, 2006 11:26 am
Location: London

Re: help with onclick and php

Post by aceconcepts »

What are you trying to do?

You are just specifying a variable with $queryupdate
ggggqqqqihc
Forum Newbie
Posts: 5
Joined: Mon Apr 28, 2008 8:08 pm
Location: China

Re: help with onclick and php

Post by ggggqqqqihc »

You'd better use a php file to handle registration. Then direct to the main page.

Is it your meaning?
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: help with onclick and php

Post by pickle »

Use proper syntax highlighting and a bunch of problems come to light.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Re: help with onclick and php

Post by RobertGonzalez »

Yeah, there are all kinds of badness happening there. Is this a PHP question or a Javascript question?
User avatar
Verminox
Forum Contributor
Posts: 101
Joined: Sun May 07, 2006 5:19 am

Re: help with onclick and php

Post by Verminox »

By the way, other than the syntactical errors, I hope that your php $queryupdate, whatever it is, is just echo-ing more Javascript into the page. If you think that you can put function calls, etc. there that will execute when the html object is clicked (because its inside the onClick handler), then you're wrong. PHP cannot respond to client-side calls, it's a server side language whose job is finished once the page loads.
Post Reply