Is this Possible Or not?

12 replies
I am wondering and I know this is a very stupid question but please bear with me...

I have got this php order button that I have added to an html page.. And only got it to work once. Now it doesnt.. It only works when I convert the whole html into php...

Is there anyway that I can put some php code into a standard html page and make it work without converting it all to php?

If not I have another question for you
#html #php
  • Profile picture of the author RichPirate
    Yes.. just put your code in <?php ?> tag.

    For example:

    HTML Code:
    <html>
    <body>
    <h1>Hello Word</h1>
    
    <?php echo "Hello"; ?>
    
    </body>
    
    </html>
    {{ DiscussionBoard.errors[1348853].message }}
    • Profile picture of the author Byron_Wells
      Originally Posted by RichPirate View Post

      Yes.. just put your code in <?php ?> tag.

      For example:

      HTML Code:
      <html>
      <body>
      <h1>Hello Word</h1>
       
      <?php echo "Hello"; ?>
       
      </body>
       
      </html>
      Alright

      I did put the following code into the html file

      <?php $orderlink = 'http://www.your-order-link.com'; ?>
      <P ALIGN=Center style="font-family: impact; font-size: 30pt;">
      <FONT COLOR=#cc0000>Claim Your Copy Now!</FONT>
      <P>
      <CENTER><TABLE border="0" cellspacing="0" cellpadding="0">
      <TR>
      <TD><div onclick="location.href='<?=$orderlink;?>';" style="cursor: pointer;">
      <TABLE style="border: 6px dashed #cc0000; border-collapse: collapse;" cellspacing="0" cellpadding="20" bordercolor="#111111">
      <TR>
      <TD>
      <P ALIGN=Center style="font-family: Tahoma; font-size: 20pt;">
      <FONT COLOR="#004488">Regular Price <STRIKE>$297</STRIKE> Today
      $97</FONT><BR>
      <A HREF="<?=$orderlink;?>" TARGET="_top"><IMG SRC="images/addtocart.jpg" BORDER="0"><BR>
      Add to Cart</A>
      <P align=center>
      <A HREF="<?=$orderlink;?>" TARGET="_top"><IMG SRC="images/mastercard.gif" BORDER="0"><IMG
      SRC="images/visa.gif" BORDER="0"><IMG SRC="images/amex.gif" BORDER="0"><IMG
      SRC="images/diners.gif" BORDER="0"><IMG SRC="images/jcb.gif" BORDER="0"><IMG
      SRC="images/discover.gif" BORDER="0"><IMG SRC="images/PayPal.gif" BORDER="0"></A>
      </TD>
      </TR>
      <TR>
      <TD>Testing The Marketing</TD>
      </TR>
      </TABLE></div>

      </TD>
      </TR>
      </TABLE>
      </CENTER>

      It only worked once.. But not anymore... Confused
      {{ DiscussionBoard.errors[1350215].message }}
      • Profile picture of the author jwlnewsome
        Sorry byron_well misunderstood what was wanted. if you just want php to run in a html file just change the file extension as advised by Nick H. you dont really want to mess with the .htaccess file (dragons hide there).
        {{ DiscussionBoard.errors[1350870].message }}
      • Profile picture of the author Byron_Wells
        Originally Posted by Nick H View Post

        You have the right code in there. Rename your file from .html to .php

        For instance, if you have "index.html" then rename that one file to "index.php"

        Be sure you have a good HTML document with the proper HTML headers and tags.

        And be sure to remove any .htaccess code that you might have inserted trying to get this to work.

        Ok I have already done that Change over to php code.. But for some reason when in Internet explorer 8 Auto Blog Feeder the Claim Your Copy Now! part near where the order button is, is in big red letters.. However when I look in firefox browser the words are small?

        Also the php code that I showed covers the whole of the order button section.. At the moment the whole area is clickable.. I would like to add a second row to the table at the bottom, but not make that part clickable
        {{ DiscussionBoard.errors[1351488].message }}
      • Profile picture of the author Byron_Wells
        Originally Posted by Nick H View Post

        You have the right code in there. Rename your file from .html to .php

        For instance, if you have "index.html" then rename that one file to "index.php"

        Be sure you have a good HTML document with the proper HTML headers and tags.

        And be sure to remove any .htaccess code that you might have inserted trying to get this to work.

        Ok I have already done that Change over to php code.. But for some reason when in Internet explorer 8 Auto Blog Feeder the Claim Your Copy Now! part near where the order button is, is in big red letters.. However when I look in firefox browser the words are small?

        Also the php code that I showed covers the whole of the order button section.. At the moment the whole area is clickable.. I would like to add a second row to the table at the bottom, but not make that part clickable
        {{ DiscussionBoard.errors[1351516].message }}
        • Profile picture of the author Mike P Smith
          Originally Posted by Byron_Wells View Post

          Also the php code that I showed covers the whole of the order button section.. At the moment the whole area is clickable.. I would like to add a second row to the table at the bottom, but not make that part clickable
          The "<div>" with the onclick is what's making that entire table clickable (your cursor: pointer; style gives you the pointer).

          If you want to add a second row, do this:

          old:
          </TABLE></div>

          </TD>
          </TR>
          </TABLE>


          new:

          </TABLE></div>
          </TD>
          </TR>

          <tr>
          <td>....your new content here...</td>
          </tr>

          </TABLE>


          You can even use the <div> element for the content if you wish (although not required). Just make sure not to put the "onclick" there or it will be clickable.

          --
          Mike Smith
          What? No Sig!
          {{ DiscussionBoard.errors[1351924].message }}
          • Profile picture of the author Byron_Wells
            Originally Posted by Mike P Smith View Post

            The "<div>" with the onclick is what's making that entire table clickable (your cursor: pointer; style gives you the pointer).

            If you want to add a second row, do this:

            old:
            </TABLE></div>

            </TD>
            </TR>
            </TABLE>

            new:

            </TABLE></div>
            </TD>
            </TR>

            <tr>
            <td>....your new content here...</td>
            </tr>

            </TABLE>

            You can even use the <div> element for the content if you wish (although not required). Just make sure not to put the "onclick" there or it will be clickable.

            --
            Mike Smith
            What? No Sig!
            Mike

            Thanks for that.. Nearly right..

            I not sure if you have noticed that there is a red border around it.. If you take a look here http://www.digitalresellersvault.com...1/version1.php

            I would like the text to be in the red dashed part....
            {{ DiscussionBoard.errors[1352006].message }}
            • Profile picture of the author Mike P Smith
              Originally Posted by Byron_Wells View Post

              I would like the text to be in the red dashed part....
              Ah - ok. Right now the table (which has the red border) is inside the <div> that contains the clickable part. So you'll need to make some changes.

              Right now you have this:

              <TD><div onclick="location.href='<?=;?>';" style="cursor: pointer;">
              <TABLE style="border: 6px dashed #cc0000; border-collapse: collapse;" cellspacing="0" cellpadding="20" bordercolor="#111111">
              <TR>
              <TD>
              <P ALIGN=Center style="font-family: Tahoma; font-size: 20pt;">
              ...rest of your content here...
              </TD>
              </TR>
              <TR>
              <TD>Testing The Marketing</TD>
              </TR>
              </TABLE></div>
              </TD>


              Change it to this:

              <TD>
              <TABLE style="border: 6px dashed #cc0000; border-collapse: collapse;" cellspacing="0" cellpadding="20" bordercolor="#111111">
              <TR>
              <TD>
              <div onclick="location.href='<?=;?>';" style="cursor: pointer;">
              <P ALIGN=Center style="font-family: Tahoma; font-size: 20pt;">
              ...rest of your content here...
              </div>
              </TD>
              </TR>
              <TR>
              <TD>Testing The Marketing</TD>
              </TR>
              </TABLE>
              </TD>

              Noticed where I moved that "div". You still get the same functionality (well, except that the red dashed border itself won't be clickable, but every else will). You can then replace "Testing The Marketing" with any content you wish, and it will not be clickable, since it's outside the <div>.

              And you can just keep adding rows via "<tr><td>...content...</td></tr>".

              I noticed the PHP tags didn't copy over correct in my example, so just make sure those copy on your side correctly.

              HTH

              --
              Mike Smith
              Still no advertising sig. What am I thinking?
              {{ DiscussionBoard.errors[1355633].message }}
  • Profile picture of the author Gimme4Free
    To make .html files interperate PHP add a htaccess file to the folder in which the files are stored with the following:
    Code:
    AddType application/x-httpd-php .php .html
    {{ DiscussionBoard.errors[1349116].message }}
  • Profile picture of the author jwlnewsome
    the file for the htaccess need to be in the root of the file directory, of the html file, you wish to add the php to and saved as ".htaccess"

    the full .htaccess file will look like

    Code:
    Options +FollowSymLinks
    RewriteEngine on
    application/x-httpd-php .php .html
    {{ DiscussionBoard.errors[1349309].message }}
    • Profile picture of the author Byron_Wells
      Originally Posted by jwlnewsome View Post

      the file for the htaccess need to be in the root of the file directory, of the html file, you wish to add the php to and saved as ".htaccess"

      the full .htaccess file will look like

      Code:
      Options +FollowSymLinks
      RewriteEngine on
      application/x-httpd-php .php .html

      How did it work once?
      {{ DiscussionBoard.errors[1350219].message }}

Trending Topics