PHP click event handlers

前端 未结 1 1251
离开以前
离开以前 2021-01-06 15:23

I\'m new to PHP programming and I wanted to know that is it possible to handle PHP events as we do in ASP.NET

I mean I\'ve got a img and I want to perform some task

1条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-06 15:32

    PHP itself does not handle client-side events. And PHP paradigm slightly differs from ASP.NET where client and server-side scripds bound together in the same page of code. On client-side, use javascript to handle onClick event, and in event-handler code issue AJAX call to your designated PHP page to send back a response.

    
    name:
    

    Hell

    And this is a test.php code:

    Username too short\n";
    }
    
    switch($name) {
    case 'bob':
    case 'jim':
    case 'joe':
    case 'carol':
      return "Username already taken\n";
      }
    
      return "Username ok!\n";
    }
    
    echo validate(trim($_GET['name']));
    ?>
    

    0 讨论(0)
提交回复
热议问题