Re: [PHP-DB] IF ( $_POST['submit'] == Update Subscriptions OR $_POST['submit'] == Update Entire Account ) {

2007-03-21 Thread Vicente
Ron wrote:

 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.  

logical. It is not well structured.

When clicking UPDATE ADDRESS you are accomplishing the second IF.

When you click UPDATE ENTIRE ACCOUNT, you are accomplishing the
first IF and here it's the end of your process. You cannot expect
more things than those present inside this first IF.

As Bastien Koert wrote, it would be better only one button,
You can show all the actual dates to the user:

form ...
input value=? echo $row['phone'];?
input value=? echo $row['address'];?
etc...
input type=submit...
/form

when users changes any of them, after clicking on submit button
also the rest of unchanged data will be saved.
In this way you only need one condition:

if ($_POST['submit'] == Update Entire Account) {
   // UPDATE all fields
}


best regards,

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] IF ( $_POST['submit'] == Update Subscriptions OR $_POST['submit'] == Update Entire Account ) {

2007-03-19 Thread bedul
hi..
- Original Message -
From: Ron Piggott [EMAIL PROTECTED]
To: PHP DB php-db@lists.php.net
Sent: Monday, March 19, 2007 4:26 AM
Subject: [PHP-DB] IF ( $_POST['submit'] == Update Subscriptions
OR$_POST['submit'] == Update Entire Account ) {



 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 read this line.. and this was realy a waste of script.. i mean this line
$_POST['submit']== Update Entire Account
why this line always show up every if line?? i don't know what your script
looks like.. but i sure you this line is waste of typing.


 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.
from i read above.. when you click update every account. it respond to do
function in this if line
if ( $_POST['submit'] == Update Subscriptions OR $_POST['submit'] ==
Update Entire Account ) {

from this point i suggest to not use submit as condition to begin a
function. are your page contain a lot submit button??
fyi.. i'm indonesian and i'm not good on english.. so forgive me. what i
mean about function in here was.. something below the if

 if ( $_POST['submit'] == Update Subscriptions OR $_POST['submit'] ==
Update Entire Account ) {
//this where i mean function //
}

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] IF ( $_POST['submit'] == Update Subscriptions OR$_POST['submit'] == Update Entire Account ) {

2007-03-18 Thread Bastien Koert
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 [EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]
To: PHP DB php-db@lists.php.net
Subject: [PHP-DB] 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=2cid=A6D6BDB4586E357F!142


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php