malikye Posted December 20, 2011 Share Posted December 20, 2011 i'm trying to learn how to make an array. the user will type in a text box, and i want them to receive a "Yes" or "No" if what they type matches my array. but for some reason, my answer is always "No". here is my code: <?php $qual=array('html','web','graphic','SQL'); ?> <?php if ($qualification==$qual) echo "Yes"; else echo "No"; ?> what am i doing wrong? Quote Link to comment https://forums.phpfreaks.com/topic/253523-help-with-array/ Share on other sites More sharing options...
MasterACE14 Posted December 20, 2011 Share Posted December 20, 2011 if (in_array($qualification, $qual)) Quote Link to comment https://forums.phpfreaks.com/topic/253523-help-with-array/#findComment-1299580 Share on other sites More sharing options...
Pikachu2000 Posted December 20, 2011 Share Posted December 20, 2011 Look at in_array. Quote Link to comment https://forums.phpfreaks.com/topic/253523-help-with-array/#findComment-1299581 Share on other sites More sharing options...
malikye Posted December 20, 2011 Author Share Posted December 20, 2011 MasterACE14, Thank you so much!!! Quote Link to comment https://forums.phpfreaks.com/topic/253523-help-with-array/#findComment-1299583 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.