Jump to content

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


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!

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.