Page 1 of 1

php file instead of a function in onclick event

Posted: Thu May 24, 2007 11:13 am
by phpDVWeaver
I do have this button
<input type="button" name ="next" onclick="">
for the onclick event I wanna run a php file called next.php.

I tried

<input type="button" name ="next" onclick="<?php include('next.php');?>">
and
<input type="button" name ="next" onclick="<?php run('next.php');?>">

but none of them worked.

any ideas

Posted: Thu May 24, 2007 11:18 am
by RobertGonzalez
Moved to PHP - Code.

You are trying to do something client side. PHP is server side. To get what you want, you will either need to link to the PHP app or use Javascript to push the action to a PHP app.

Posted: Thu May 24, 2007 11:29 am
by phpDVWeaver
Man I just don't know how did I forget that. that 's the main difference beween javascript and php.

thanks a lot

Posted: Fri May 25, 2007 5:57 pm
by lanasa
Sounds like you're gonna need to use AJAX. Try this tutorial AJAX and PHP

Posted: Fri May 25, 2007 6:06 pm
by RobertGonzalez
I don't think he's going to need to use AJAX. He can if he wants to, but it isn't required to achieve what he ultimately wants to achieve.

As for the link, that is borderline advertisement, so I'd ask that you keep that to a minimum. Thanks.