Title: Unexpected T_String &#8211; Problem with if/else
Last modified: August 20, 2016

---

# Unexpected T_String – Problem with if/else

 *  [littlethoughts](https://wordpress.org/support/users/littlethoughts/)
 * (@littlethoughts)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/unexpected-t_string-problem-with-ifelse/)
 * Hello,
 * It’s my first time using PHP – so please forgive simple syntax mistakes. I’ve
   been trying for some hours to get this right, but don’t seem to find a way.
 * What I want: A specific permalink to a specific page. Therefore I use the “the_ID()”
   function to give the html unique IDs. I store them in the “$postid” variable.
   For the link I now want to use an if/else statement, checking the ID of the post
   and giving it a certain permalink if the ID is true. Here’s the code:
 * 9 <div id=”polaroid-<?php $postid = the_ID(); ?>”>
    10 <div class=”polaroidimage”
   ><a href=”<?php 11 if($postid == 668) { 12 echo “get_permalink(127)”; } elseif(
   $postid == 665) { echo “get_permalink(75)”; } else($postid == 661) { echo “get_permalink(
   9)”; } ?>” title=”<?php the_title_attribute(); ?>” rel=”bookmark”> <?php if ((
   function_exists(‘has_post_thumbnail’)) && (has_post_thumbnail()) ) { echo get_the_post_thumbnail(
   $post->ID); } else { echo main_image(); } ?> </div>
 * The error that I get: “Parse error: syntax error, unexpected T_STRING in /var/
   www/web1295/html/wp-content/themes/polaroids/index.php on line 12” I’ve wrote
   the lines until line 12.
 * If you would be so kind and help me out? Maybe have a better idea to solve the
   problem? I’ve been trying to google it out, but didn’t succeed.
    Thanks and love!

Viewing 1 replies (of 1 total)

 *  Moderator [keesiemeijer](https://wordpress.org/support/users/keesiemeijer/)
 * (@keesiemeijer)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/unexpected-t_string-problem-with-ifelse/#post-2960020)
 * Try changing this:
 *     ```
       else($postid == 661) {
       ```
   
 * to this:
 *     ```
       elseif($postid == 661) {
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘Unexpected T_String – Problem with if/else’ is closed to new replies.

## Tags

 * [if statement](https://wordpress.org/support/topic-tag/if-statement/)
 * [parse-error](https://wordpress.org/support/topic-tag/parse-error/)
 * [T_STRING](https://wordpress.org/support/topic-tag/t_string/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [keesiemeijer](https://wordpress.org/support/users/keesiemeijer/)
 * Last activity: [13 years, 10 months ago](https://wordpress.org/support/topic/unexpected-t_string-problem-with-ifelse/#post-2960020)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
