Parse Error : syntax error, unexpected T_STRING, expecting ',' or ';'

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • paulrajj
    New Member
    • Sep 2008
    • 47

    #1

    Parse Error : syntax error, unexpected T_STRING, expecting ',' or ';'

    hi to all,

    i am getting syntax error on my code..

    Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in D:\xampp\htdocs \Dummy\paulraj\ matrim\exam.php on line 62

    what's the actual problem here..?

    my code



    [code=php]
    echo '<input type="image" name="'.$i.'_im g" value="'.$i.'_i mg" src="'.$imagesA rray['src'][$i].'" alt="'.$imagesA rray['alt'][$i].'" onclick="docume nt.getElementBy Id('img').src=t his.src; document.getEle mentById('img') .alt=this.alt;" />'; /* line 62 */[/code]
    Last edited by pbmods; Sep 20 '08, 07:31 AM. Reason: Added CODE tags.
  • bnashenas1984
    Contributor
    • Sep 2007
    • 257

    #2
    The problem is that you can NOT use single qoute inside another one.

    If you need to do it then you have to put a \ before them. I changed your code

    Code:
    echo '<input type="image" name="'.$i.'_img" value="'.$i.'_img" src="'.$imagesArray['src'][$i].'" alt="'.$imagesArray['alt'][$i].'" onclick="document.getElementById(\'img\').src=this.src; document.getElementById(\'img\').alt=this.alt;" />';
    Last edited by pbmods; Sep 20 '08, 07:32 AM. Reason: Fixed CODE tags.

    Comment

    • pbmods
      Recognized Expert Expert
      • Apr 2007
      • 5821

      #3
      bnashenas, please proof your posts and fix your code tags. If you can't figure out why your post isn't formatting correctly, please PM a moderator.

      Comment

      • paulrajj
        New Member
        • Sep 2008
        • 47

        #4
        The problem is solved...

        Thanks a lot.....

        Comment

        Working...