Title: Error in my php code
Last modified: September 25, 2025

---

# Error in my php code

 *  [sacconi](https://wordpress.org/support/users/sacconi/)
 * (@sacconi)
 * [8 months ago](https://wordpress.org/support/topic/error-in-my-php-code/)
 * This code is not working:
 *     ```wp-block-code
       $output2 = '<form>'; $content2 = ' "<a href='".get_permalink( get_the_ID() )."#my_map_123'><img src='/wp-content/uploads/2023/07/map-3.jpg'/></a>" ' ; $content2 = $output2 . $content2 . '</form>'; echo $content2;
       ```
   
 * The code is inside php tags
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Ferror-in-my-php-code%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Moderator [threadi](https://wordpress.org/support/users/threadi/)
 * (@threadi)
 * [8 months ago](https://wordpress.org/support/topic/error-in-my-php-code/#post-18656566)
 * What does “not working” mean? Syntactically, it is correct, but the structure
   is wrong. However, this should not lead to errors.
 *  Thread Starter [sacconi](https://wordpress.org/support/users/sacconi/)
 * (@sacconi)
 * [8 months ago](https://wordpress.org/support/topic/error-in-my-php-code/#post-18656571)
 * I got a permanent error, so, what is wrong in the structure? I need a button,
   when I press the button the visitor is guided directly to the map related to 
   that apartment
 *  Moderator [threadi](https://wordpress.org/support/users/threadi/)
 * (@threadi)
 * [8 months ago](https://wordpress.org/support/topic/error-in-my-php-code/#post-18656576)
 * I just noticed that you mixed up the quotation marks in the code. That’s what’s
   causing the error.
 * If you just want a button, the following is all you need:
 *     ```wp-block-code
       echo '<a href="' . get_permalink( get_the_ID() ) . '#my_map_123"><img src="/wp-content/uploads/2023/07/map-3.jpg"/></a>"';
       ```
   
 *  Thread Starter [sacconi](https://wordpress.org/support/users/sacconi/)
 * (@sacconi)
 * [8 months ago](https://wordpress.org/support/topic/error-in-my-php-code/#post-18656591)
 * …I’ve seen that I mixed 2 codes, I just needed an image with a link, so I’m using
 *     ```wp-block-code
       echo "<a href='".get_permalink( get_the_ID() )."#my_map_123'><img src='/wp-content/uploads/2023/07/map-3.jpg'/></a>" ;
       ```
   
 * how can I style it? using a <span ID: “xxx”> ? the tag span goes after “echo”?–
   thank you
 *  Moderator [threadi](https://wordpress.org/support/users/threadi/)
 * (@threadi)
 * [8 months ago](https://wordpress.org/support/topic/error-in-my-php-code/#post-18656700)
 * When you talk about styling, I would expect a solution using CSS. For example,
   you can assign colors to a link as follows:
 *     ```wp-block-code
       a { background-color: red; }
       ```
   
 * Of course, you would also have to address the button directly, so give it a class:
 *     ```wp-block-code
       echo '<a class="button" href="’ . get_permalink( get_the_ID() ) . '#my_map_123"><img src="/wp-content/uploads/2023/07/map-3.jpg"/></a>';
       ```
   
 * and then address it via CSS as follows:
 *     ```wp-block-code
       a.button { background-color: red; }
       ```
   
 * Of course, I don’t know what kind of display you want to use at this point. CSS
   offers a wide range of possibilities, so there is no need to inflate the HTML
   code.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Error in my php code’ is closed to new replies.

## Tags

 * [php](https://wordpress.org/support/topic-tag/php/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 5 replies
 * 2 participants
 * Last reply from: [threadi](https://wordpress.org/support/users/threadi/)
 * Last activity: [8 months ago](https://wordpress.org/support/topic/error-in-my-php-code/#post-18656700)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
