CodeIgniter Forums

Full Version: ask about onchange and onclick php
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]C_Line[/eluser]
i have a problem with onchange and onclick
i wan enter a value in textbox and call the function
like this :

========================================================
<input onchange="here()" type="text"name="qty">

<?php
function here()
{
echo "hello";
}
?>
=========================================================

but, when i entered the value, here() function didn't call
please help me, and sorry my bad english Big Grin
thx

El Forum

[eluser]Nisha S.[/eluser]
PHP is a server side scripting language and cannot be called directly from client side. You can write a javascript with the function name and inside you can call php function by calling the relevant URL.

[removed]
function here()
{
alert("hello");
// call the url to executes the funcion. Given pattern below for codeigniter. Use ajax if you don't want to redirect to another page.
[removed] = "http://www.yourwebsite.com/controller/function";
}
[removed]

El Forum

[eluser]C_Line[/eluser]
this my url

localhost/ex/index.php/main/come

when i redirect using window . location
window . location = "how"

localhost/ex/index.php/main/come/how

but, i wan

localhost/ex/index.php/main/how

thx for replies

El Forum

[eluser]C_Line[/eluser]
SOLVED

thx for replies Nisha S Big Grin