- This topic is empty.
Viewing 9 posts - 1 through 9 (of 9 total)
Viewing 9 posts - 1 through 9 (of 9 total)
- The forum ‘Back End’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Hi, Im new to php so I’m having a small problem with if statments
basically I want an out put to be if its less that 18 to show less than 18 message, if its more than 23 then show its more than 23 message and if its a range between 18 and 23 to say a mid range message. I can get it to output corectly for more than 23 and less than 18 but I cant get it to output for anything between 18 and 23.
can any one help please
(http://codepen.io/anon/pen/qdKyp “code on codepen”)http://codepen.io/anon/pen/qdKyp[code is here](http://codepen.io/anon/pen/qdKyp “code on codepen”)http://codepen.io/anon/pen/qdKyp
if ($result < 18) {
// less than 18
} elseif ($result > 23) {
// more than 23
} else {
// between 18 and 23
}
when i change the last elseif to else the page dosent display
You have
23 or $resultB = range(18,23)): ?>
23): ?>
if you change the last elseif to `` it doesn’t work?
You might as well remove the outer if by the way, it does nothing.
23 or $resultB = range(18,23)): ?>
23): ?>
yep thats what I have and I changed to:
23 or $resultB = range(18,23)): ?>
23): ?>
if change to else then page does not load.
should be
All working now, thank you for your help :) learned alot there…. also removed outer if statement cheers