php file instead of a function in onclick event

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
phpDVWeaver
Forum Commoner
Posts: 28
Joined: Sun Apr 29, 2007 11:00 pm

php file instead of a function in onclick event

Post 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
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post 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.
phpDVWeaver
Forum Commoner
Posts: 28
Joined: Sun Apr 29, 2007 11:00 pm

Post 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
lanasa
Forum Newbie
Posts: 14
Joined: Mon Mar 26, 2007 7:49 am
Location: Buffalo, NY

Post by lanasa »

Sounds like you're gonna need to use AJAX. Try this tutorial AJAX and PHP
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post 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.
Post Reply