Jump to content

PHP code not interpreted

Recommended Posts


I am trying to display a report (set of returned data from a mysql backend). The site was made with Dreamweaver templates and other PHP code works but that is code that is called by the form. For this report I have php code in line since all it will do is display a report. It is witin the editable region of the HTML file.
Once I run the page and view source below is the excerpt I see in the view source window. Nothing displays on the form other than an empty table.

Obviously below I'm just tryint to get any php code interpreted. I've tested the SQL statement and the program outside the dreamweaver HTML file and it works.

Any suggestions?

Thanks in advance!

<td><!-- InstanceBeginEditable name="page_body" -->
<table width="200" border="1">

<td>[!--coloro:#CC66CC--][span style=\"color:#CC66CC\"][!--/coloro--]<?php echo "Hello World"; ?>[!--colorc--][/span][!--/colorc--]</td>
<td> </td>
<td> </td>
[i] [!--coloro:#CC66CC--][span style=\"color:#CC66CC\"][!--/coloro--]<?php
$chapterTitle = 'PHP Syntax';
$message = "The chapter you are currently reading is $chapterTitle";
echo $message;
<p> </p>
<p> </p>
<!-- InstanceEndEditable -->
Link to comment
Share on other sites

[!--quoteo(post=354344:date=Mar 12 2006, 05:11 PM:name=moberemk)--][div class=\'quotetop\']QUOTE(moberemk @ Mar 12 2006, 05:11 PM) [snapback]354344[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Unless the code is an include file, Dreamweaver-generated, or extension-generated, Dreamweaver won't show it in any helpful way, just as a block of PHP code.

I've tried using both methods, that is basically all the code within the HTML file and an include file

<?php include (./includes/view_user.php) ?>

Neither method actually executes the code. It't almost like it a comment.
Link to comment
Share on other sites

[!--quoteo(post=354382:date=Mar 12 2006, 08:23 PM:name=sgb162)--][div class=\'quotetop\']QUOTE(sgb162 @ Mar 12 2006, 08:23 PM) [snapback]354382[/snapback][/div][div class=\'quotemain\'][!--quotec--]
If you're looking to test PHP files offline, I think your best bet is to download and install apache. <_<

I have both Apache and PHP installed and running. The PHP file on it's own works just fine. It's when I either include it into the Dreamweaver HTML file (based on a template) either directly or via an include file that it is not interpreted.

So the commands in a PHP file I call directly work, imbedded (or included via the include statement) within the HTLM file is not interpreted. When I view source I see basically either the code or the include statement. See example from my first posting.

Link to comment
Share on other sites

[!--quoteo(post=354387:date=Mar 13 2006, 02:40 AM:name=sgb162)--][div class=\'quotetop\']QUOTE(sgb162 @ Mar 13 2006, 02:40 AM) [snapback]354387[/snapback][/div][div class=\'quotemain\'][!--quotec--]
For any PHP to run the file has to be saved as a .php file.

whilst this is obvious, it's actually spot on - and unless something drastically wrong is going with your setup or your file naming, i'd run with this answer. i very much doubt that dreamweaver has anything to do with it - once the file is in the browser, dreamweaver has nothing to do with it.

if you have PHP set up, and it works for PHP files, then my guess is the files youre embedding PHP into are HTM/HTML files or similar, in which case the server wont even bother parsing them as php.
i kinda reckon that it's good practice to always use the same extensions throughout the site, even if a file uses no php in it at all.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.