2019-01-04 05:14
浏览 74


This question already has an answer here:

I'm just getting to know PHP so please bear with me if my question is not clear. I have a user registration page that collects a field called "zodiac" which is uploaded to the database. I can easily call the variable $zodiac and the value, let's say, "Aries" is displayed on the desired user's page depending on who is logged in. However, instead of the text, I'd like to display a corresponding image file on the page from my local drive. I've tried the "elseif" statements but it doesn't seem to be working. Although I do get an image with the statement it doesn't seem to change when I change users:

These are properly being loaded to the desired page:


if($zodiac='Aries') {
   echo '<img src="../assets/images/zodiac/Aries.png" width="45" height="35" />';
    }elseif($zodiac='Taurus') {
   echo '<img src="../assets/images/zodiac/Taurus.png" width="45" height="35" />';
    }elseif($zodiac='Gemini') {
   echo '<img src="../assets/images/zodiac/Gemini.png" width="45" height="35" />';

The "elseif" statement continues to the end.

Hope this makes sense. Thanks for any input.

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

相关推荐 更多相似问题