Page 1 of 1

[solved] if then show problem

Posted: Mon Feb 16, 2004 11:59 am
by melindaSA
My problem is the following: I have an open jobs database that the user seleclts the open job and the results are shown. However, I would like the heading "Experience" to show only if there is info in "Required Experience" or "Preferred Experience" or "Other Experience" fields (true in one or all)

Here is my code that I cannot get to work:

Code: Select all

<?php
if ($positions['r_experience' || 'p_experience' || 'o_experience']) {
    echo '<b>Experience </b><br><br> ';
    }
    if ($positions['r_experience']) {
    echo '<blockquote><b>Required:<br></b> ' .$positions['r_experience'] . '<br></blockquote>';
    }
    if ($positions['p_experience']) {
    echo '<blockquote><b>Preferred:<br></b> ' .$positions['p_experience'] . '<br></blockquote>';
    }
    if ($positions['o_experience']) {
    echo '<blockquote><b>Other:<br></b> ' .$positions['o_experience'] . '<br></blockquote>';
    }
?>
I would appreciate some help on this, as I have been trying to get this to work for days!!! :(
Thank you!

Posted: Mon Feb 16, 2004 12:08 pm
by AVATAr
first.. it will be something like this:

if ($positions['r_experience'] || $positions['p_experience'] || $positions['o_experience']) {

what is stored in $positions['r_experience'] and those vars?

Posted: Mon Feb 16, 2004 12:13 pm
by malcolmboston
damn u, i was just writing a big piece of code :twisted:

Posted: Mon Feb 16, 2004 12:21 pm
by AVATAr
ups.. sorry ;)

Posted: Mon Feb 16, 2004 12:21 pm
by melindaSA
Thank you AVATAr, it now works!

Posted: Mon Feb 16, 2004 12:25 pm
by melindaSA
malcomboston -- ?? :?

Posted: Mon Feb 16, 2004 12:32 pm
by malcolmboston
my code was identical in outcome to avatar but slightly different

but it works now so no need to type it again

also can you please change the topic name to [SOLVED]if then show problem

thanx