• Resolved D12Eminem989

    (@d12eminem989)


    I am trying to use the following code in my theme, but am returning an error listed bellow:

    The Code:
    <?php
    $my_values = get_post_meta( $post->ID, 'tape_popup', true );
    if( $my_values ) {
    echo "<form><input type="button" value="Popup the MP3 Player" onClick="javascript:popUp('http://www.mydomain.com/popup/' . $my_values . '.html')"></form>";
    } else {
    echo 'No popup yet';
    }
    ?>

    The Error:
    Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/user/public_html/wp-content/themes/Trill/single.php on line 47

    Any help would be much appreciated!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Your echo statement is placing quotes inside quotes without escaping them. I think this is what you want:

    echo "<form><input type=\"button\" value=\"Popup the MP3 Player\" onClick=\"javascript:popUp('http://www.mydomain.com/popup/" . $my_values . ".html')\"></form>";
    Thread Starter D12Eminem989

    (@d12eminem989)

    That worked great, thank you very much! 🙂

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

The topic ‘Custom field parse error’ is closed to new replies.