473,396 Members | 1,608 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

failing elseif construct

Hi,

Can anybody see anything wrong with this:

<-- snip -->
// some other ifs and elseifs that seem to work okay

elseif ($CH_address_same != 1)
{
if ($PayMethod == "credit" && empty($CH_Address1)
|| $PayMethod == "credit" && empty($CH_City)
|| $PayMethod == "credit" && empty($CH_Zip)
|| $PayMethod == "credit" && empty($CH_Country))
{
$err = 1;
}
}

The CH_address_same variable is being posted to the server using a checkbox
with a checked value of '1'.

For some reason if the first clause returns true the second clause chokes?
I can't see why. But I am a beginner!

B
Jul 16 '05 #1
2 1855
Study the example....maybe it'll get to you.... :)

just copy-paste and run....

<?php

If($_SERVER{'REQUEST_METHOD'}=="POST")
{
print("<u>These variables are posted:</u><br>\n");
foreach($_POST as $name=>$value)
print("Variable <b>$name</b> has value $value.<br>\n");
}

?>
<html>
<head>
<title>CheckBoxes</title>
</head>
<body>
<form name="testForm" action="<?=$_SERVER{'PHP_SELF'} ?>" method="POST">
<input type="checkbox" name="Check_1">Text_1
<input type="checkbox" name="Check_2">Text_2
<input type="submit" name="submit" value="Submit">
</body>
</html>

hope this help...

point
"Bert" <no@spam.com> wrote in message
news:bh*******************@news.demon.co.uk...
Hi,

Can anybody see anything wrong with this:

<-- snip -->
// some other ifs and elseifs that seem to work okay

elseif ($CH_address_same != 1)
{
if ($PayMethod == "credit" && empty($CH_Address1)
|| $PayMethod == "credit" && empty($CH_City)
|| $PayMethod == "credit" && empty($CH_Zip)
|| $PayMethod == "credit" && empty($CH_Country))
{
$err = 1;
}
}

The CH_address_same variable is being posted to the server using a checkbox with a checked value of '1'.

For some reason if the first clause returns true the second clause chokes?
I can't see why. But I am a beginner!

B

Jul 16 '05 #2
On Tue, 12 Aug 2003 19:46:02 +0100, Andy Hassall wrote:
<snip!>

Be a bit more specific. 'choke' isn't a Boolean value...
<snip!>


It could be...

if ($choke) {
$cpr->heimlich($victim);
}
--
Jeffrey D. Silverman | jeffrey AT jhu DOT edu
Johns Hopkins University | Baltimore, MD
Website | http://www.wse.jhu.edu/newtnotes/

Jul 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: James | last post by:
Hi, I have a form with 2 fields. 'A' 'B' The user completes one of the fields and the form is submitted. On the results page I want to run a query, but this will change subject to which...
7
by: Lauren Quantrell | last post by:
Is there any speed/resource advantage/disadvantage in using Select Case x Case 1 Case 2 etc. many more cases... End Select VS.
5
by: Leon | last post by:
Is there anyway I could clean-up all these ElseIF statements with a select/case or is this the best that can be done ("I can't think of a better way")? Private Sub Update_Click(ByVal sender As...
6
by: Ivan Sergio Borgonovo | last post by:
First thanks to Tom Lane who helped me promptly. Now let's come to the problem: create or replace function testa( ) returns char(32) as ' begin if 1=2 then if 1=2 then
3
by: xSmilinx | last post by:
Hey guys.. Im a total beginner to VB :) Im not sure if i was supposed to post this here or in the Access Forums as im using VB in Access. But heres my code: Private Sub English1_GotFocus() ...
4
by: Pyenos | last post by:
class Model: Controller() class View: Model() class Controller:pass Python interpreter complains that 'Name Error: Controller()' not defined.
3
by: amrhi | last post by:
Hy guys , I try to make conditional statement by using if and elseif . the problem are if i use 2 conditional statement the script run well but if try add more conditinal statement it's not working...
17
by: JRough | last post by:
I'm trying to get error proof code. I have this code which seems to work but now I look at it I think it should be elseif not else and I wonder why it works. It is in the block:...
13
by: scottbouley | last post by:
HELP! I'm trying to check a form for missing values. Two of the fields are required and therefore the corresponding message boxes are VBOkOnly. The other two are for warning purposes and their...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.