#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Posts
    2
    Rep Power
    0
    I want to build a html form which will be submitted to a php file. The php
    file consists of a few functions, the values of the html form has to be
    processed by one of these functions. How do i get those values to the right
    function?
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    London/UK
    Posts
    91
    Rep Power
    15
    Hi Daan

    lets say you've got 3 variables in your form

    <form method="post" action="./page.php">
    <input type="text" name="name">
    <input type="text" name="email">
    <input type="text" name="phone">
    <input type="submit" name="submit" value="make it so">
    </form>

    when you post your form to page.php, these vaiables are now $name,$email,$phone - you are now free to process them how you wish

    say you have a function make all the values BOLD and print them on the screen

    page.php would have in it

    <?

    function make_bold($incoming) {
    print "<b>" . $incoming . "</b><br>";
    }

    if ($submit) {
    make_bold($name);
    make_bold($email);
    make_bold($phone);
    }
    ?>

    that's probably a crap example as you are typing in more text there than you would write if you just wrapped <b> tags around the incoming variables, but it gives you the basic idea

    hth

    bealers



    ------------------
    http://back-end.org
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Singapore
    Posts
    7
    Rep Power
    0
    Hi Bealers,

    It is a good tip. Now, I have a variable $anr which is not part of the form. How can I carry it over to the next php program, at the same time? I tried to insert it somewhere in the form, but the user can easily change the value, and that is bad for me.

    Regards: AsianHelp

    ------------------
    -Living is about breathing-
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    London/UK
    Posts
    91
    Rep Power
    15
    make the field hidden

    i.e.

    <input type="hidden" name="task" value="dosoemthing">

    regs

    Bealers

    ------------------
    http://back-end.org

Similar Threads

  1. Dynamic Forms on Pocket IE
    By HarryJ in forum HTML Programming
    Replies: 0
    Last Post: January 15th, 2004, 12:56 PM

IMN logo majestic logo threadwatch logo seochat tools logo