IF ( $_POST["submit"] == "Update Subscriptions" OR
IF ( $_POST["submit"] == "Update Subscriptions" OR
am 18.03.2007 22:26:15 von Ron Piggott
--=-FAnjN03fFV/h08rs9HqT
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
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
--=-FAnjN03fFV/h08rs9HqT--
RE: IF ( $_POST["submit"] == "Update Subscriptions" OR$_POST["submit"]== "Update Enti
am 18.03.2007 22:35:36 von 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
>Reply-To: ron.php@actsministries.org
>To: PHP DB
>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=2&cid=A6D6BDB4586E357F!1 42
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: IF ( $_POST["submit"] == "Update Subscriptions" OR$_POST["submit"] == "Update Ent
am 19.03.2007 05:06:46 von Haydar TUNA
Hello,
Can you send your HTML form structure? How many HTML form do you
use? It's important to solve your problems :)
--
Haydar TUNA
Republic Of Turkey - Ministry of National Education
Education Technology Department Ankara / TURKEY
Web: http://www.haydartuna.net
"Ron Piggott" , haber iletisinde þunlarý
yazdý:1174253176.6772.28.camel@localhost.localdomain...
>
> 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
>
>
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: IF ( $_POST["submit"] == "Update Subscriptions" OR $_POST["submit"] == "Update En
am 20.03.2007 03:03:27 von bedul
hi..
----- Original Message -----
From: "Ron Piggott"
To: "PHP DB"
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: IF ( $_POST["submit"] == "Update Subscriptions" OR $_POST["submit"] == "Update En
am 21.03.2007 17:29:54 von 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:
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