ifis Posted January 10, 2008 Share Posted January 10, 2008 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 Quote Link to comment Share on other sites More sharing options...
rhodesa Posted January 10, 2008 Share Posted January 10, 2008 you want a switch statement Quote Link to comment Share on other sites More sharing options...
ifis Posted January 10, 2008 Author Share Posted January 10, 2008 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! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.