PDA

View Full Version : An if question



Dennis_Gull
05-28-2007, 03:17 PM
Hello, I have some problems with an if statement I have like 5 variables that I need to have posted, I think its easiest to post an example:

lets say I have: Name, age, desc, country and number and lets say I want to post name, age, desc and ->country or number<- but if I write it like this code down here I it will think its ->name,age,desc and country<- or number:
heres the code:


if (isset($_POST['name']) && isset($_POST['age']) && isset($_POST['desc']) && isset($_POST['country']) || isset($_POST['number']))


So my question is: how will I be able to just use "or" on the last statement.

Twey
05-28-2007, 03:23 PM
With brackets:
if(
isset($_POST['name']) &&
isset($_POST['age']) &&
isset($_POST['desc']) &&
(
isset($_POST['country']) ||
isset($_POST['number'])
)
)

Dennis_Gull
05-28-2007, 03:35 PM
Thanks for the help, I tried that but had another "error" in the statement =)

djr33
05-28-2007, 05:59 PM
Looks right to me. What is the error?