468,321 Members | 1,738 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,321 developers. It's quick & easy.

Call function from a <form>

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
1 2425
Banfa
9,041 Expert Mod 8TB
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.

Similar topics

2 posts views Thread by Ricki Susic | last post: by
6 posts views Thread by Michael Hamm | last post: by
10 posts views Thread by Phlip | last post: by
6 posts views Thread by snacktime | last post: by
reply views Thread by NPC403 | last post: by
1 post views Thread by howard w | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.