• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 417
  • Last Modified:

I need onchange equivalent of Select Tag in PHP


  Can any one find the equivalent PHP code for this html select tag

  <select name="searchlist"  onchange="opt2txt(this)">

  Thanks :)
  • 2
1 Solution
Since PHP is a server-side language, and doesn't directly monitor changes on the client-side, there is no PHP equivalent to that statement in PHP. The only way you may incorporate PHP into that statement is to leave it as it is and have the onchange function call an AJAX routine that triggers a php script
Loganathan NatarajanLAMP DeveloperCommented:
There is no "onchange equivalent" code in PHP instead of HTML ... you can rewrite it in php like this,

echo '<select name="searchlist"  onchange="opt2txt(this)">';

Open in new window

Hi there,

Yes there is not equivalent code in php for onchange but you can use "AJAX" to call php functions for executing php codes
Google for "ajax"

Loganathan NatarajanLAMP DeveloperCommented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now