Wouldn't the simplest solution be to update the entire account all the time?
You are presenting all the data to the user each time any way...so updating
the record is a given anyway.
The benefits are that the sql is simplified since there are only two
statments (insert and update) and the code is easier since you only maintain
the if statement for the two branches
hth
Bastien
From: Ron Piggott <ron.php@xxxxxxxxxxxxxxxxxx>
Reply-To: ron.php@xxxxxxxxxxxxxxxxxx
To: PHP DB <php-db@xxxxxxxxxxxxx>
Subject: IF ( $_POST['submit'] == "Update Subscriptions"
OR$_POST['submit'] == "Update Entire Account" ) {
Date: Sun, 18 Mar 2007 17:26:15 -0400
I am wanting to ask a question about IF statements.
I have been developing a PHP > mySQL based subscription tracking
application.
I am trying to set up an administration screen now where admin could
update an address, e-mail address, subscription(s), etc. OR (and this is
the key) update the entire account.
I have this series of IF statements (below). I have a bunch of SUBMIT
buttons on the admin screen so if someone just wants to update the
address on the admin screen the "Update Address" button may be
clicked ... and it is right near the fields to input a change of
address. Same thing with "Update Subscriptions". But if the account
needs multiple changes I have an "UPDATE ENTIRE ACCOUNT" button at the
bottom.
Here are the series of IF statements used to process the form.
if ( $_POST['submit'] == "Update Subscriptions" OR $_POST['submit'] ==
"Update Entire Account" ) {
} elseif ( $_POST['submit'] == "Update Address" OR $_POST['submit'] ==
"Update Entire Account" ) {
} elseif ( $_POST['submit'] == "Update E-Mail Address" OR
$_POST['submit'] == "Update Entire Account" ) {
} elseif ( $_POST['submit'] == "Submit Birth Date" OR $_POST['submit']
== "Update Entire Account" ) {
}
I am stuck again. If on the admin screen someone clicks "UPDATE
ADDRESS" the address change is saved. BUT if I try to do an address
change and then click "UPDATE ENTIRE ACCOUNT" the address change isn't
saved.
Does someone have experience with the IF command that could help me. I
am trying to make it so that I don't have to have the commands in the
PHP script that processes the form twice by including the " OR
$_POST['submit'] == "Update Entire Account" ) "
Ron
_________________________________________________________________
Have Some Fun Out Of The Sun This March Break
http://local.live.com/?mkt=en-ca/?v=2&cid=A6D6BDB4586E357F!142
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php