Call function from <form>

Ask a Question related to PHP Development, Design and Development.

  1. #1

    Default 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


    Ricki Susic Guest

  2. Similar Questions and Discussions

    1. Function call
      Hi, I need to call a function in my asp.net application from a vb.net windows application running on the same machine. Is this generally...
    2. How do I call a function?
      created a function: how do I call it? thx
    3. Flash MX 2004 Prof - Form application function call question
      I have a flashmx 2004 professional application using forms. I am able to call methods on my application form from child forms with no problem. ...
    4. How do I call an outer function from a class method function?
      I'm sorry guys but this is a bad day for me. I tried researching this one and was totally stonewalled (see...
    5. How to call perl function from PHP
      I have a function writen in Perl that takes a name-value list (array) as argument and returns a name-value list (array). My question is: How to...
  3. #2

    Default Re: Call function from <form>

    In article <3f73e270$0$97259$edfadb0f@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:
    [url]www.badgerbadgerbadger.com[/url]
    Eto Demerzel Guest

  4. #3

    Default Re: Call function from <form>

    Or maybe you should use JavaScript at that point...


    "Eto Demerzel" <eto.demerzel@fijivillage.com> wrote in message
    news:MPG.19ddf8c38cee648898971a@news-text.blueyonder.co.uk...
    > In article <3f73e270$0$97259$edfadb0f@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:
    > [url]www.badgerbadgerbadger.com[/url]

    Yves Brault Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139