Page 1 of 1

help with onclick and php

Posted: Wed Apr 30, 2008 12:24 am
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.

Re: help with onclick and php

Posted: Wed Apr 30, 2008 4:19 am
by aceconcepts
What are you trying to do?

You are just specifying a variable with $queryupdate

Re: help with onclick and php

Posted: Wed Apr 30, 2008 9:51 am
by ggggqqqqihc
You'd better use a php file to handle registration. Then direct to the main page.

Is it your meaning?

Re: help with onclick and php

Posted: Wed Apr 30, 2008 9:58 am
by pickle
Use proper syntax highlighting and a bunch of problems come to light.

Re: help with onclick and php

Posted: Fri May 02, 2008 1:21 pm
by RobertGonzalez
Yeah, there are all kinds of badness happening there. Is this a PHP question or a Javascript question?

Re: help with onclick and php

Posted: Fri May 02, 2008 1:48 pm
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.