473,396 Members | 1,913 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Call function from <form>

Hi,
Can anyone tell me if it is possible to call a function from a html form,
where the function is included in the same file as the form.
<html>
<body>

<form method="post" action="what do I write here to acces function test()">
<input type="text" name="tekst">
<input type="submit" value="send">
</form>

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

Regards Ricki
Jul 17 '05 #1
2 21662
In article <3f***********************@dread12.news.tele.dk> , Ricki
Susic's output was...
Hi,
Can anyone tell me if it is possible to call a function from a html form,
where the function is included in the same file as the form.

The HTML form needs to be a part of a .php file - and so action should =
"filename.php" or do something like

<?PHP
printf("<FORM action=\"$PHP_SELF\" method=\"post\">");
?>

You can do something along the lines of

if ($tekst) {
Function_WhateverGoesHere();
}
to determine if something has been sent to the script already, or if you
should just be displaying the form.
**_ IF you have register_globals turned OFF (Like I should have by now)-
$tekst will be $HTTP_POST_VARS['tekst']
instead.
--
CurrentlyRavingabout:
www.badgerbadgerbadger.com
Jul 17 '05 #2
Or maybe you should use JavaScript at that point...
"Eto Demerzel" <et**********@fijivillage.com> wrote in message
news:MP************************@news-text.blueyonder.co.uk...
In article <3f***********************@dread12.news.tele.dk> , Ricki
Susic's output was...
Hi,
Can anyone tell me if it is possible to call a function from a html form, where the function is included in the same file as the form.

The HTML form needs to be a part of a .php file - and so action should =
"filename.php" or do something like

<?PHP
printf("<FORM action=\"$PHP_SELF\" method=\"post\">");
?>

You can do something along the lines of

if ($tekst) {
Function_WhateverGoesHere();
}
to determine if something has been sent to the script already, or if you
should just be displaying the form.
**_ IF you have register_globals turned OFF (Like I should have by now)-
$tekst will be $HTTP_POST_VARS['tekst']
instead.
--
CurrentlyRavingabout:
www.badgerbadgerbadger.com

Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Sims | last post by:
Hi, This will validate, (http://validator.w3.org/) <form method="POST" action="" name='xForm' style='background:inherit;'> <table style='background:inherit; width:100%;'> <tr width=80%> <td>...
6
by: Michael Hamm | last post by:
Hi, I'm trying to write a <form> whihc will retrieve a Web page on another server. I have (essentially) this: <form action="http://cgi.cs.indiana.edu/~oracle/digest.cgi"> <input...
2
by: Keiron Waites | last post by:
I have the following code: <input type="text" name="search" class="search_top"> <a href="" onclick="window.location='search.inc.php'+document..search. value; return false;"...
3
by: Don | last post by:
Hi all, Is there some way in a <form> tag to transfer control to a JavaScript function after completion of the submit, where the <form> and function are on the same page? I believe ONSUBMIT and...
3
by: Ben | last post by:
Here's my form: <form name="aForm" method='post'> <input type=file name=file1 onkeypress='KeyPress()'><br> <a id='attachMoreLink' href='javascript:AddFileInput()">Attach More Files </a> <input...
10
by: Phlip | last post by:
HTMListas: (Apologies for I can't Google for this - too many common words.) I have a <form> tag. It thinks I want a <p> break before and after the form. I don't. (My forms are sneaky and...
6
by: snacktime | last post by:
I've searched and searched and have not found a solution to suppress the margin on form or href tags so that there is no space before or after the tag. The only way I have found to do this is to...
4
by: rob c | last post by:
This is a minor thing and only appears in IE (so far), but I'd like to know to correct it (if possible). Whenever I use a form on a webpage, Explorer always leaves a blank line following the...
1
by: jeni | last post by:
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\"...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.