By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
462,237 Members | 593 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 462,237 IT Pros & Developers. It's quick & easy.

Call function from a <form>

P: 5
Can anyone tell me if it is possible to call a function from a php form (which use html),
where the function is included in a class in another php file..

<?php
echo "<pre><form method=\"post\" action=\="what do I write here to acces function test()">";

echo "<input type="text" name="tekst">";
echo"<input type="submit" value="send">";
</form>
?>

<?php
function test(){
echo $tekst;
}
?>


Regards Jeni
Aug 14 '06 #1
Share this Question
Share on Google+
1 Reply

Banfa
Expert Mod 5K+
P: 8,968
This is not possible in the way you describe, all php code runs server side but the form runs client side.

You have to provide a link to a new php script (or the same one) and as the server serves the script it is run with any data from the form.
Aug 14 '06 #2

Post your reply

Sign in to post your reply or Sign up for a free account.