Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4

Thread: php in php?

  1. #1
    New Coder
    Join Date
    Jan 2004
    Posts
    61
    Thanks
    0
    Thanked 0 Times in 0 Posts

    php in php?

    PHP Code:
    <?php
    $name1 
    "d1.html";
    $title1 "a";
    ?>

    <?php
    echo "
    <table width="
    680" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="
    338"><div align="center">Title</div></td>
        <td width="
    342"><div align="center"></div></td>
      </tr>
      <tr>
        <td><?php echo $title1 ?>&nbsp;</td>
        <td><a href="
    <?php echo $name1 ?>">NAME</a>&nbsp;</td>
      </tr>
    ";
    ?>

    Parse error: parse error, expecting `','' or `';'' in name.php on line 8; any way i can fix this?

  • #2
    New to the CF scene
    Join Date
    Jan 2004
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i dont see why you need that <? ?> in the link, when you already have one around the table(which covers the whole table i think)

    but im more than likely wrong cause im a noob at php

  • #3
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You can not use double quotes (") inside adouble-quoted string, unless you escape them (like \"). Try
    PHP Code:
    <?php
    $name1 
    "d1.html";
    $title1 "a";
    echo (
    '<table width="680" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="338"><div align="center">Title</div></td>
        <td width="342"><div align="center"></div></td>
      </tr>
      <tr>
        <td>' 
    .  $title1 '&nbsp;</td>
        <td><a href="'
    $name1 .'">NAME</a>&nbsp;</td>
      </tr>'
    );
    ?>

  • #4
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,273
    Thanks
    4
    Thanked 83 Times in 82 Posts
    Or an easier way would be to just not put everything in a string.

    PHP Code:

    <?php
    $name1 
    "d1.html";
    $title1 "a";
    ?>

    <table width="680" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="338"><div align="center">Title</div></td>
        <td width="342"><div align="center"></div></td>
      </tr>
      <tr>
        <td><?php echo $title1?>&nbsp;</td>
        <td><a href="<?php echo $name1?>">NAME</a>&nbsp;</td>
      </tr>
    You don't have to echo everything using PHP. Just the parts that need it.
    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •