SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Jun 2007
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    calling a php Function from checkbox's click event

    i have a checkbox name=chkpatient . and i have a textbox . i have writen a php function . function name is checkboxchecked.my objective is i want to call these pHP function from check'box onclick event. the moment i will click on the check box it will print "checked".

    function checkboxchecked()
    {
    if($_REQUEST['chkpatient']=="ON")
    {
    $yes="checked";
    print $yes;
    }

    }

    now my objective is i want to call that function

  2. #2
    rajug.replace('Raju Gautam'); bronze trophy Raju Gautam's Avatar
    Join Date
    Oct 2006
    Location
    Kathmandu, Nepal
    Posts
    4,013
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Use javascript for such things PHP cannot do it since it is Server Side language.
    Mistakes are proof that you are trying.....
    ------------------------------------------------------------------------
    PSD to HTML - SlicingArt.com | Personal Blog | ZCE - PHP 5

  3. #3
    SitePoint Zealot
    Join Date
    Jun 2007
    Posts
    150
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What you need to implement is a XMLHttp (AJAX) call and fetch a PHP url.

    onclick="checkboxchecked()"

    Which calls:

    function checkboxchecked()
    {
    if($_REQUEST['chkpatient']=="ON")
    {
    AJAXFetchPage('/scripts/checkboxRecorder.php?clicked=yes');
    $yes="checked";
    print $yes;
    }
    }


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •