A small question about PHP function declaration and calling

Source: Internet
Author: User
I want to call the PHP function declaration and call by clicking the button. how can I write this function? why don't I write onclick = "return & nbsp; check () in time () when the jump is over, he just executed it. & lt; html & gt; & lt; body & gt; & lt; button & nbsp; typ has a small problem about PHP function declaration and calling.
I want to call and execute this function by clicking the button. how can I write this function? why didn't I write onclick = "return check () in time? he just ran it.




Function check ()
{
If ($ name === _ SESSION ['username'] | $ name = "0000 ")
{
$ SQL = "DELETE FROM lostMsg WHERE msgID = '$ msgID '";
$ Result = mysql_query ($ sql1, $ conn );
If ($ result = true)
{
Echo "script window. alert ('deleted successfully! ') Script ";
Echo "script window. location. href = 'xunwu _ More. php' script";
}
}
Else
Echo "script window. alert ('you do not have this permission! ') Script ";
}
?>





------ Solution --------------------
Onclick is executed on the client.
Your requirements must be post/get to the server or ajax.
------ Solution --------------------
">

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.