[Nolug] php: multiple submits using hrefs?

From: cjones12_at_tulane.edu
Date: Sun, 28 Sep 2003 16:06:00 -0500
Message-ID: <1064783160.3f774d389c60c@webmail.tulane.edu>

You guys were very helpful before, when I had a question about php. Now I have
another. I want the user to be able to choose how to process a form, by
selecting the appropriate link from a navbar. So, if the user selects the link
"Delete selected" then all selected items are deleted from (e.g.) a database.
If the user selects the link "Add selected" then items from the form are
added. Here's a quick example of what I already know how to do. Where I would
ordinarily put a submit button I have put hrefs, and I have added one
conditional for each of the actions I want.

<form method="get" action="<?echo $PHP_SELF;?>">
        <?
                if($add){
                        /* Do something like . . . */
                        echo "Adding $textinput</br>";
                }
                if($delete){
                        /* Do something else, like . . . */
                        echo "Deleting $textinput</br>";
                }
        ?>
        <input type="text" name="textinput"></br>
        <a href=" . . . ">Delete selected</a></br>
        <a href=" . . . ">Add selected</a>
</form>

How far off the mark am I? Where do I go from here? If nobody feels like
finishing my sentence here, then at least point me in the right direction?

___________________
Nolug mailing list
nolug@nolug.org
Received on 09/28/03

This archive was generated by hypermail 2.2.0 : 12/19/08 EST