Jump to content

[SOLVED] Dealing with multiple IFs in an IF-ELSE statement


ifis

Recommended Posts

I am working on a form that depending on what a person selects form a dropdown menu, more information might or might not be required.  If more info is required I have an IF statement, but is no information is required, I just have a submit button.  Is there an elegant way to post a message, like "No furthur info is needed" without having to make IFs for every selection from the dropdown menu?  Here is the current:

<?PHP
$lic=$_POST['lic']

if ('lic'== yyyy)
{echo "<input type='text' name='moreinfoy' id='moreinfoy' />
      </label>"
}
if ('lic'== xxxx)
{echo "<input type='text' name='moreinfox' id='moreinfox' />
      </label>"
}
echo " <input type='submit' name='Submit' id='Submit' value='Submit' />
      </label>
    </p>
  </form>";
?>

THanks

Cool so it would go something like

switch('lic')
{
case yyyy:
     echo" we need more info";
     break;
case xxxx:
      echo" we need more info";
      break;
default:
      echo "no more info needed";
}

I'll plug it in, thanks, looks like exactly what I was looking for!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.