Re: changing form based on variable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Jul 20, 2010, at 13:28, David Mehler <dave.mehler@xxxxxxxxx> 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
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux