Board index   FAQ   Search  
Register  Login
Board index php forum :: HTML JavaScript

onChange to a php function

Javascript coding ..

Moderators: macek, egami, gesf

onChange to a php function

Postby shortty » Sat Sep 25, 2004 12:35 pm

:sad:

Is it possible to do something like this:

<?php

echo "<form action=\"show.php\" method=\"post\">\n";
echo "<select name=\"pair1\" onChange=\"*DO PHP FUNCTION*\">\n";
echo "<option value=\"\" SELECTED>blah</option>\n";

?>

:(

If so, please tell me how. How would I point the onChange to the php code?

Thanks.
shortty
New php-forum User
New php-forum User
 
Posts: 8
Joined: Sat Aug 07, 2004 11:12 pm

Postby bezmond » Sat Sep 25, 2004 9:26 pm

As Java is Client side, and PHP server side, this idea is not possible UNLESS you get the page to perhaps refresh and run the function you require...

Andrew
User avatar
bezmond
Moderator
Moderator
 
Posts: 312
Joined: Sat Apr 05, 2003 4:33 am
Location: Mansfield, UK

Re: onChange to a php function

Postby ruturajv » Tue Sep 28, 2004 7:39 pm

shortty wrote::sad:

Is it possible to do something like this:

<?php

echo "<form action="show.php" method="post">\n";
echo "<select name="pair1" onChange="*DO PHP FUNCTION*">\n";
echo "<option value="" SELECTED>blah</option>\n";

?>

:(

If so, please tell me how. How would I point the onChange to the php code?

Thanks.


on the onchange event you call a javascript finction
which submits the form

eg...
Code: Select all
function onchagenfn() {
  document.forms['formname'].submit();
}
User avatar
ruturajv
php-forum Super User
php-forum Super User
 
Posts: 1280
Joined: Sat Mar 22, 2003 9:42 am
Location: Mumbai, India


Return to JavaScript

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.