Re: changing form based on variable

From: Date: Tue, 20 Jul 2010 22:13:19 +0000
Subject: Re: changing form based on variable
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-307037@lists.php.net to get a copy of this message
On Jul 20, 2010, at 13:28, David Mehler <dave.mehler@gmail.com> wrote: > Hello, > I've got a form, it's sticky, and it can either display on an insert > or update. Depending on whether i'm wanting to do an insert or update > the area the form gets it's input changes. > So, i've got a name field, if it's set to insert, not sure how to > differentiate between the two actions, name gets it's input from the > value of $_POST['name'] since it's sticky. If it's set to update that > name value is filled in by the name field output in a database. Also, > if insert the button for sending the form is called "add" if update > it's called "update" I'd like to know how to pull this off, because in > both cases the form entry fields are the same, i don't want to have to > write two forms when one should work. > Thanks. > Dave. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > Simple, I assume you have an id for the record on update, so test for that and just adjust the value of the button. $btnValue = 'Submit'; If(isset($id)){ $btnValue ='Update'; } Bastien Sent from my iPod

« previous php.general (#307037) next »