/    Sign up×
Community /Pin to ProfileBookmark

PHP + HTML problem ……

i have a php function name

FUNCTION more()
{
echo “where are you”;
}

i can use a button to call this fucntion using onClick?

<input type=”button” name=”Click” onClick=”more();”>

is this make sense? or the onClick only can use for JS function?

to post a comment
PHP

4 Comments(s)

Copy linkTweet thisAlerts:
@fredmvJan 02.2004 — You can only use the [font=courier]onclick[/font] event handler for JavaScript functions.
Copy linkTweet thisAlerts:
@CainofnodJan 02.2004 — PHP is a server side technology. The onclick attribute works only with a client side language (JavaScript).
Copy linkTweet thisAlerts:
@Sux0rZh_jc0rzJan 02.2004 — not sure about this, but could one do, instead of onclick, action="more()"? or would one have to do action="more().php" and then have the php file look like this: [code=php]<?PHP
echo "where are you";
?>[/code]
pretty sure doing the action = "more().php" would work, but it'd be easier if one could do action="more()"...
Copy linkTweet thisAlerts:
@pyroJan 02.2004 — [i]Originally posted by Sux0rZh@jc0rz [/i]

[B]pretty sure doing the action = "more().php" would work... [/B][/QUOTE]
I'm pretty sure it wouldn't... ?

You'll have to reload the page, and probably set a query string (or something else) so the page knows what function to run.
×

Success!

Help @lting spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.5,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...