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 8 of 8
  1. #1
    ggp
    ggp is offline
    New Coder
    Join Date
    Nov 2006
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts

    add html code into php code.

    Hi.
    I have this set of php code and I need to add the next set of html code in the php code.
    What ever I try, it giveme errors.
    Could you help me with this plzzzz?

    Thanks.

    [HTML]
    PHP Code:
    <?php

    if (!isset($_POST['submit']) or trim($_POST['searchstring']) === '' 
    {
     if(
    trim($_POST['searchstring'] === '')) 
       { 
    include (
    'error.php');     
       } 
       
    ?>
       <form 
       </form>
       <?php
    }
    else
    {

    HERE I NEED TO ADD THE HTML CODE

       
    }
    ?>
    [/HTML]



    [HTML]
    <TABLE cellSpacing=2 cellPadding=1 width="100%" bgColor=#ffcc00 border=1>
    <TBODY>
    <TR vAlign=top>
    <TD width="20%">
    <TABLE width="100%"border=1>
    <TBODY>
    <TR>
    <TD class=w align=middle width="20%" >Categories </TD></TR>
    <TR>
    <TD class=c width"20> </TD></TR></TBODY></TABLE></TD>
    <TD width=9 bgColor=#ffffff><IMG height=1 alt="" src="t.gif" width=19></TD>
    <TD width="60%">
    <TABLE cellSpacing=2 cellPadding=1 width="100%" border=1>
    <TBODY>
    <TR>
    <TD class=w align=middle bgColor=#ffcc00>Shop.com Top 5</TD>
    </TR></TBODY></TABLE>



    <TD width="20%"> <TABLE border=1 width="100%"> <TBODY><TR><TD class=w align=middle width="20%">ADVERTISE</TD><TR><TD>GFGF</TD></TR></TR></TBODY></TABLE></TD>
    </TR></TBODY></TABLE><BR>
    <TABLE cellSpacing=2 cellPadding=1 width="100%" bgColor=#ffcc00 border=0>
    <TBODY>
    <TR>
    <TD class=c align=middle width="100%" bgColor=#fff3ac colSpan=3>


    </TD></TR></TBODY></TABLE></BODY></HTML>

    [/HTML]

  • #2
    Regular Coder BonRouge's Avatar
    Join Date
    Mar 2006
    Location
    Sendai, Japan
    Posts
    328
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Code:
    else {
    echo '
    the text goes here
    ';
    }

  • #3
    ggp
    ggp is offline
    New Coder
    Join Date
    Nov 2006
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I got this error:
    Parse error: parse error, expecting `','' or `';'' in C:\Program Files\Online Services\Apache2\htdocs\textimage201.php on line 91

    line 91:
    echo '
    <TABLE cellSpacing=2 cellPadding=1 width="100%" bgColor=#ffcc00 border=1>
    <TBODY>
    <TR vAlign=top> LINE 91
    <TD width="20%">



    [HTML]
    PHP Code:
     <?php

    }

    else
    {

     echo 
    '
    <TABLE cellSpacing=2 cellPadding=1 width="100%" bgColor=#ffcc00 border=1>
      <TBODY>
      <TR vAlign=top>
        <TD width="20%">
          <TABLE width="100%"border=1>
            <TBODY>
            <TR>
              <TD  class=w align=middle width="20%" >Categories </TD></TR>
            <TR>
              </TR></TBODY></TABLE></TD>
        <TD width=9 bgColor=#ffffff><IMG height=1 alt="" src="t.gif" width=19></TD>
        <TD width="60%">
          <TABLE cellSpacing=2 cellPadding=1 width="100%" border=1>
            <TBODY>
            <TR>
              <TD class=w align=middle  bgColor=#ffcc00>TutyShop.com Top 5</TD>
              </TR></TBODY></TABLE>
          
                 
                 
      <TD width="20%"> <TABLE border=1 width="100%"> <TBODY><TR><TD class=w align=middle width="20%">ADVERTISE</TD><TR><TD>GFGF</TD></TR></TR></TBODY></TABLE></TD>
         </TR></TBODY></TABLE><BR>
    <TABLE cellSpacing=2 cellPadding=1 width="100%" bgColor=#ffcc00 border=0>
      <TBODY>
      <TR>
        <TD class=c align=middle width="100%" bgColor=#fff3ac colSpan=3>  </TD></TR></TBODY></TABLE>
    '
    ;
      
         
       
    }
    ?>
    [/HTML]

  • #4
    Regular Coder BonRouge's Avatar
    Join Date
    Mar 2006
    Location
    Sendai, Japan
    Posts
    328
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Strange... I don't see a problem.

  • #5
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,502
    Thanks
    8
    Thanked 1,089 Times in 1,080 Posts
    You would think you could do this, with quotes like this ...

    echo'
    <img src="myphoto.jpg">
    ';

    But, I would still switch all of them around like this ...

    echo"
    <img src='myphoto.jpg'>
    ";

  • #6
    Senior Coder rafiki's Avatar
    Join Date
    Aug 2006
    Location
    Floating around somewhere...
    Posts
    2,046
    Thanks
    19
    Thanked 42 Times in 42 Posts
    PHP Code:
    <?php
    }
    else
    {
    ?>
    add your html her as normal?
    <?php
       
    }
    ?>

  • #7
    Senior Coder
    Join Date
    Jan 2007
    Posts
    1,648
    Thanks
    1
    Thanked 58 Times in 54 Posts
    Rafiki's suggestion seems the best out of all.

    Quote Originally Posted by mlseim View Post
    You would think you could do this, with quotes like this ...

    echo'
    <img src="myphoto.jpg">
    ';

    But, I would still switch all of them around like this ...

    echo"
    <img src='myphoto.jpg'>
    ";
    Actually, I recommend that you do it like this:

    PHP Code:
    echo '<tag value="something" />'
    As there are certain things that are easier (for instance javascript in onclick, etc.) when you have a single quoted string.

    Not to mention it is faster.

  • #8
    ggp
    ggp is offline
    New Coder
    Join Date
    Nov 2006
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up

    Thanks guys it got fix. You really help me.


  •  

    Posting Permissions

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