Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    PHP


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Php Code Embedded Inside Html Page Not Working.


How do I make or workaround in my Apache server to parse *.html files
for
<?php ?> code embedded in it?

Currently php recognises <?php ?> tag only if the file has a *.php
extension. Any php code inside *.html or *.htm is ignored.

Since I dont have admin access to the server or admin person, changing
the php configuration is out of choice. Now I have to go thru echo
and print statemnets to get it work. But it looks very cumbersome and
prone to errors.




View Complete Forum Thread with Replies

Related Forum Messages:
Embedded HTML In Php Code With 5.1.1
why this code works in 4.X, 5.0.X and not in
5.1?

<?php
function myfunction(){

*** php code ***
?>
<a href="bla.bla">bla</a>
<?
*** php code ***

}

?>

when i run it under 5.1 i get the error "Parse error: syntax error,
unexpected $end in" on the last line of the file. i drop the embedded
html and it works fine.

i know doing it this way is kinda sloppy and on my list of things to
fix, but that can't be done right now. is there some setting in 5.1
where i can turn this back on or do i have to downgrade to 5.0 again.

View Replies !
Proper Syntax For Php Embedded In Html Web Page
I am about ready to start pulling out (what's left of) my hair. I am new to php programming and could use some help. I have spent a huge amount of time reading through three php books and searching through the forums, tutorials, code examples, etc. here before asking this question. I am also betting that there are a LOT of php 'newbies' that struggle with this same problem. (And yes, I have looked at "syntax" in the Php manual).

Here's the problem. The form displays properly as an html page. It even displays properly with the following php code placed just before the closing "</body>" tag in the web page. Code:


View Replies !
If Statement Is Not Working The Code Inside
My if statement is not working the code inside is being ran everytime even when it dont meet the conditions, when i test my code with echo on the update statement its not liking lines brings up an undefined index notice for these lines Code:

View Replies !
PHP Code Inside Html Textbox
I am trying to be able to display a texbox with a default value from php. I also want a function to run when the textbox is selected to tell the user what format the data should be entered in. I am trying. Code:

<td><input name="sdate" type="text" maxlength="11" value=<?php echo '"'.date("Y")."-01-01"; ?> onfocus="dateHelp()"/></td>

But it isn't working and is displaying "2006-01-01 onfocus=" inside the text box, and not running the dataHelp. If I remove the php and use. Code:

<td><input name="sdate" type="text" maxlength="11" value="" onfocus="dateHelp()"/></td>

it works fine, but with no default value from php. How can I get them both to work together? I am sure I am missing out something silly like double quotes.

View Replies !
Script From Inside An HTML Page
To call a php script from inside an HTML page I use the href tag with a
link like http://www.mydomain.com/script.php. This works but is it the
best way / only way?

View Replies !
Paste HTML Page Inside Text Area
i want to create a newsletter or emailer form sender. and that form has a text area. can be an ordinary text area or can also be tinymce.

i want to have the text area in such a way that an HTML page can be pasted in the text area (let say the html page is jobpost.html) and send it to the email address that i specified.

View Replies !
Embedded Movie Not Working
help to check what's wrong with my code? I could not get to play the embedded movie file.

View Replies !
Embedded Not Working From Other Machine?
I have set up my laptop to be a server, installed PHPDEV, it all works fine. I open PHP files on it from another machine and it also works fine, the html and php work as expected.

I've just tried from another WinXP machine and it doesn't display PHP. If I open this: (22.33.44.55publicest.php) Code:

View Replies !
How To Store HTML Code (with " ", ' ') Inside A Variable In Php Script?
Assuming i have this simple script :

<?PHP

//Opening tag ='
$html_header='
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
' // Closing tag ='

echo $html_header;

?>

If the opening & closing tags are both ' then it works fine, but if the
html script itself contains a ' then i need some way to escape it, no ?

How should i do it if i had something like <HEAD><TITLE='PHP foo'></HEAD>?

View Replies !
Detect Embedded Code?
Here is a question that just occurred to me. I recently created a BBS
(Bulletin Board Service) on my website where I allow people to post
messages via a form. It just occurred to me that conceivably they
could embed php code in their message trying to 'hack' my site. So I
added the following check in my code to detect the case-insensitive
string '<?php' and if I find that I disallow the post. Code:

View Replies !
Parsing String With Embedded PHP Code...
On my webserver right now, I have a folder of webpages with embedded PHP coding. Because the dynamic content changes very infrequently, I've written a script which generates a "static cache" of HTML pages from the PHP pages. It works by automatically looping through all PHP pages in the folder. For each, it reads the contents of the PHP file into a variable, then creates a new HTML page with the same name and writes the contents of the variable to it. After the process is complete, the cache of HTML files gets uploaded to the website for public viewing.

However, if the script reads the contents of the PHP pages through the local filesystem, the temporary variable (and thus the resulting static .html page) will have PHP code within it, which is obviously no good.

Therefore, at the moment, the script reads the contents of the PHP pages by opening an http connection to where they reside on the public webserver... this makes the contents of the temporary variable equivalent to the HTML that would be outputted when any user accessed the PHP page through the WWW, which is exactly what I want.

However... my problem is that the http connections are much slower than reading through the local filesystem, and moreover, I don't necessarily want the PHP pages to be publicly accessible through a webserver, which is currently required for the script to work. Is there any way that I can take a PHP string that has embedded PHP code and tell PHP to "parse the PHP out of it"?

View Replies !
PHP Saving Embedded HTML In XML
I hope there is a simple solution to this, but I've been unable to
find it.

$dom = new DomDocument();
$dom->load("test.xml");

$test = $dom->getElementsByTagName("test");
$test->nodeValue = "<b>test</b>";
$dom->save("test.xml");

I would like the node in the xml file to look like:
<test><b>test</b></test>

Rather than the encoded version.
&lt;b&gt;test&lt;/b&gt;

View Replies !
How To Get HTML Code Of Another Page
Can someone direct me to a code that will go to another page and retrieve the html source for parsing within a php script?

View Replies !
HTML Editing Of .php Code Page ?
I run a few web pages that contains php code that was written for me
by someone else. By reading his original code I have leaned a little
and have made the occasional change. I would like now to add some
basic html to the page and prefer to use HTML editing software to
accomplish the task. I have run it to problems however. If I use
Mozilla HTMl editor in WYSWYG mode , any changes I make do not work.
After I upload to my server, all I see is a web page with mostly the
raw php code. I tried Page Breeze HTML editor and it will not load
.php files in to its WYSWYG editor.

So, any changes I make have to be done in raw source code mode, a
rather laborious task for this inexperienced HTML person. Is there
anything that would made the task of adding HTML to a php page ,
easier ? I'm not attempting to add anything in to the main body of
php code, just mainly looking to add some html tables with images
preceding the start of php scripts, or after php scripts.

View Replies !
Parsing PHP Code In An HTML Page!
I am trying to run PHP code from an HTML file. In my HTML file I have the following code:

<?php include("<counter/counter.php");?>

Now I have read several threads here on Webmaster World, and I have concluded that I need to create a ".htaccess" file, and place the following code in it:

AddType application/x-httpd-php .php .htm .html

But, once I have done this, every time I visit a page on my site, I get the Open/Save this file dialog. It seems like the server is telling my browser, to open all HTML files with the external application called "application/x-httpd-php". Code:

View Replies !
How To Strip Styles Embedded Within Html Tags?
I'm a complete PHP n00b slowly finding my way around
I'm using the following function that I found on php.net to strip
out html and return only the text. It works well except for when
you find styles embedded within the tags
eg: <h3 id="pageName">Have a great day!! </h3>
This throws an error, whereas
<h3 >Thank you for your purchase! </h3works like a charm.
It also falls over when crappy code has <h3>&nbsp;</h3between
the tags.

What do I need to add to the below function to get it to work on
cases like above?

The function is:

function html2txt($txt){
$search = array('@<script[^>]*?>.*?</script>@si', // Strip out
javascript
'@<[/!]*?[^<>]*?>@si', // Strip out
HTML tags
'@<style[^>]*?>.*?</style>@siU', // Strip style
tags properly
'@<![sS]*?--[

]*>@', // Strip
multi-line comments including CDATA
"@</?[^>]*>*@"

);
$text = preg_replace($search, '', $txt);
return $text;
}

View Replies !
Dynamic Page HTML Code Question
I'm gonna have all my pages load up a dynamic header and footer, depending on what variable I call up.

So at the beginning of my code it will call for a banner, this banner will be set as a variable in a seperate page that i'll call up.

Now i'm wondering, can the page I call up (with a list of variables) have HTML code in it, like this:

View Replies !
Displaying Html Code On PHP Generated Page
I am trying to create a link page in my php application. this is a page that will display a block of html code that a visitor can copy and paste into their web site to create a link back to mine. My PHP page has a line in it like this:

define('TEXT_INFORMATION', '<html page code is here>');

I have added the html code to create the page as noted above. the page contains a same of the banner image file and the html code that goes alon with it. My problem is that I haven't been able to "quote" the html code so that ir will not be executed.

every time I try to run the application from my web server my page will display two copies of the banner iimage not on banner image and text block like it should. Any suggestions?

View Replies !
Problem With XHTML Parsers With Embedded HTML (e.g. Firefox Et-al)
I've got some code I wrote in PHP that will generate a new argument
string for the browser, but the xhtml parser in Firefox and Opera both
complain about my use of &var=value pairs.

Below is my code that generates the string :

function InvokeURL(url_to_forward_to)
{
try
{
var xfamElem = document.getElementById('xFamily');
var mainform = document.getElementById('mainform');
var new_url = url_to_forward_to + "&variable=" + xfamElem.value;

mainform.action = new_url;
mainform.submit();
}
catch(error)
{
alert("InvokeURL encountered an error :" + error.description);
}
}

This works fine with *many* browsers except the new ones.. With IE on
windows (IE6) and Opera, Firefox all complain, Safari and some older
browsers seem to work OK..

If I change the line with the new_url variable setting on it to use a
&amp; instead, it passes the XHTML tests but no longer works at all.. When
using the &amp; it still has that in the URL that shows in the address
bar and hence it seems to cause the script on the other end a lot of
problems as it is unable to properly parse the URL string.

Any ideas on how to portably get around this problem with embedded &
created URL's?

View Replies !
Problem With Displaying A Html Form Embedded In FIREFOX
I'm not sure if this is a php related issue, or if the problem lies with firefox, but i am having trouble making a form embedded in php display correctly in firefox. It displays perfectly fine in IE. Code:

View Replies !
Using A Msword Document Embedded In A PHP Page
can anyone please tell me what should i do to display in a portion of a
php page the contents of a Word document? (If it is possible)

View Replies !
Setup A Proper HTML Mail Message With Embedded Href Links
How may I setup a proper HTML mail message with embedded href links
using PHP, that follows all the MIME rules?

View Replies !
When A Search Engine Spiders A Page Does It Read The Raw Code Or The Parsed Html?
When a search engine spiders a page does it read the raw code or the parsed html? I ask as I want to confirm if any text retrieved from a database is 'read' not the php code that gets the data.

View Replies !
Can't Get Apache To Run PHP Inside Html From Localhost - Works Fine From /var/ww/html
I had a look at the stantonfinley fedora core 5 instructions and robooted but to no avail. PHP scripts work fine from var/www/html whether the suffix is .php or .htm but not from localhost. Code:

View Replies !
Working With A Table From Inside A Databse Row
I have a simple site layout. Everything is being pulled from a
database in such fashion that Page 1 of the site is referenced by
'pagename.php/?id=1', Page 2 is referenced by 'pagename.php/?id=2', and
so forth. In other words, I have only one page 'pagename.php' with a
couple of conditional statements and a navigation bar as a form using
method "get".

I need the middle content part on page 'pagename.php/?id=3' to pull
some information from a completely separate table. Is there a way to
accomplish that without resorting to

if ($_GET[id] = 3) {
// do a completely separate page layout with data pulled by the
needed page
}

I don't want to hardcode the condition because a user may delete row
where id=3.

Basically, is there a way to run a database query from inside a
database row while in phpMyAdmin?

View Replies !
Window.open Not Working From Inside User Defined Function
I'm trying to use window.open from inside a user defined function, and it's not working. Code:

View Replies !
Code Inside Phpmailer
I want to send people in my email database information that I have in there. Basically I am sending players in a hockey league player info through an email. I figured the easiest way to do this is by emailing them a table with the results of my database query in it. When I tried to do this using phpmailer I got very lost. Everything is fine except I'm not sure how to structure the code inside the $body variable so that it will show up in the email. Code:

View Replies !
Php Code Inside A Variable
I want to write a piece of code to a file using fwrite, but I am having trouble storing php code in a variable. I keep returning errors like unexpected T_STRING tec.

$whileloop = '<?php while ($row = mysql_fetch_array($result)){echo "<a href="$row['PageName'].php"> $row['PageName']</a>"}'

Is there a way to store PHP code in a variable, so it is not interpreted as php whilst in the variable, and then just written to a text file with the extension .php for processing later?

View Replies !
Code Inside Javascript
How can i add php script inside javascript function with variable of javascript .

so far i have tried following but its not working :

function(){
var any=100;
document.write("<?php mysql_query("INSERT INTO table VALUES "+any+"") ?>");
}

View Replies !
Code Inside Echo
when i write a code like that:

<?php if($_SESSION['user']!= admin) { echo "<a href="userprofile.php?userID=<?php echo ($query['userID']);?>">User</a>"; }?>

i have an error message which indicates the code's line as "Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING"

how can i a php code inside an echo tag?

View Replies !
Working With Sessions And Storing Credit Card Info Inside A Session
have a security concern working with sessions and storing credit card info inside a session, going to the payment gateway, redirecting back to my page and doing a soap connection and processing the order with the session variables, and then destroying the session afterwards.

is it safe enough to store credit card information in this manner, can hackers get to this? cause its possible to view POST variables with a firefox plugin.

or is it safer to write it to a temporary database table, do what i need to do and then delete the row?

View Replies !
Can You Run Regular Php Code Inside A Script Tag?
Just wondering if it's possible to execute a php function inside a script tag following a event on the web page. Code: example

<head>
<script language="php">
function month()
{}
</script>
</head>
<body>
<inpute type=submit onclick=month();>
</body>

View Replies !
PHP Code Inside Java Functions ...
I'm trying to build a web based application that will mimic a production scoreboard used on a manufacturing floor. Basically what these scoreboards do is show a daily production goal for how many units to build, show how many units should be off the line by whatever time it currently is, show how many actual units have gone off the line (actuated by pushing a button) and finally shows a + or - variance. (Like we are up by 10, down by 3, etc)

Anyway, I have a basic framework already setup which involves several scripts and a database to hold each days build total. However the part I'm having trouble with is a way to build a display function which can be left on all day long, every day. Now unfortunately web sites just aren't meant to stay open and active for long periods of time. My original display page basically stayed inside a while loop and kept updating the numbers on the display, however eventually the browser just gives up and stops loading the page.

So my question is, are there any tricks to let my do some PHP code inside of java functions? That way I could use java time functions to do a loop and I think the browser would be more accomodating. However I don't see how this could work, as once the page is loaded I'm not sure you can do anything with PHP anymore.

Anyone have any thoughts or anything on all of this? Keep in mind the overall goal is to have a page that can be left fully unattended for over 8 hours at a time (preferabbly "forever") but keep checking a DB entry in a MySQL database every so many "specified units of time".

View Replies !
Use Php Inside Javascript Promt Box Code?
I have a question about mixing js and php. I have a checkout section on my site that ends in a confirmation page that has a table of of the ordered items - at this point I want to ask the client if they have a coupon - so I accomplished that by an input button that on click goes to this js function: Code:

View Replies !
Running Code Inside Of Quotes?
I'm calling a function that returns a table in html. I want to populate this table with results from a query. I'm having a problem because the return statement is in quotes.

function return_display($queryresults){
return ' How can I run a loop in here? ';
}

View Replies !
Can I Put PHP Code Inside Javascript .js File?
I have a javascript .js file, can I have php code like <?=$myvar;?> inside the .js file? will it work?

View Replies !
PHP Code Inside Of Mysql Cells
I am building a dynamic section, but within each cell I would like to have php code. Everytime I echo it onto a page, the code comes out unrendered. ex:

<?
$str = $row['desc']; //$str = 1 2 3 <?php echo "4";?> 5
echo $str;
?>

results in:
1 2 3 <?php echo "4";?> 5

I would like it to echo
1 2 3 4 5

How would I do this, if possible.

View Replies !
Code Inside Include File
I'm new to php and i have an include file with some php inside that kills the rest of the page content for some reason. I have this code in my webpage:

<?php
session_start();
session_name('polv_id');
$page_title = 'User Login'
include('./header.php');
include('./pageheader.php'); <--- This is the problem
include('./pagecontbody.php');
include('./pageleftcol.php');
include('./pagerightcol.php');
?>

View Replies !
Php Inside Html Or Html Inside Php
To have a big (complete file) php tag and print the html code, or to have a html file and just insert php code when necesary ?
I would like to know this from the programming point of view and from the performance.

For example, I have big and complicated tables that I would like to write in plain html and insert some php variables, so, I'll had to open a tag, print a variable and close it a lot of time.
If there's is any other thing that I didn't mention about this, please tell me.

View Replies !
Inside HTML
According to accessibility rules. One problem (among others) i found is, i get an error using php files as src in iframes. According to the site here i test it i sould use HTML files in it. So after i searched the forum, and semm's like there's no way to include php code inside html files if you don't change your apache (n/a). Does this

<script language='php'>...</script>

also works only in php files.

View Replies !
Inserting Code Inside String, Preg_replace
I have a string containing a (possibly large) block of html. I need to
insert code (an image to be precise) right after the last textual
character in the string.

This is, of course, no problem if the end
contains plain text and no html. If the string ends in HTML however, I
need to fiddle around. for example consider that the string ends like
"... lorem ipsum.</p></blockquote>". I need to insert code between
"ipsum." and "</p>".

So what kind of regular expression I need, or is there another way I
have missed, to insert code into the string, right after the last
visible character, but before the possibly following html tags (usually
ending tags such as the mentioned </p> and </blockquote>).

View Replies !
How Can I Put XSL Tag Inside HTML Form Tag?
Sorry I couldn't find a XML/XSL group
I can only post these groups close to my subject.

In JSP (Java Server Page) you can do something
like this

<%
String v = myBean.getValue();
%>

<form .... >
<input name="myTag" value="<%= v %>">
</form>

You can do the similar thing in PHP.

But when I try in XSL I got error.

I have an XML file

<myTag attribute1="value1" />

Now I want to transform it into HTML form tag used XSL template
But XSL doesn't like this

<input name="myTag" value='
<xsl:value-of select="@attribute1" />
'></input>

How can I solve this problem?

View Replies !
IF Inside HTML Echo
I'm echoing the HTML which makes a checkbox, how can I make it checked based on an IF inside the echo itself? It works fine if I code it HTML with a nested php line. This works: PHP Code:

View Replies !
Executing HTML Inside An Email
I want to display my contents in tabular form inside an email. my code is ...

$tab1 = "<table><tr></tr></table>";

mail ("xyz@gmail.com"," ", $tab1, " ");

But i m getting all the tags as they are in tab1 instead of a table !

View Replies !
Escaping Inside Mail() To Add Html
I'm using mail() and am trying to email the contents of a form. I can do this successfully until I try and make what is emailed from that form a little more complicated. Right now I have:

mail( "me@myemail.com", "This is a test",
  "Message goes here",
"From:$first_name $last_name <$email>
Content-type: text/html; charset=us-ascii");

This works as it should. In my "Message goes here", section I have listed the vars and text, as you might expect, and I am formatting it very basically with simple tags for line break, and strong text etc. The problem I have comes when I am trying to have it send the results of a number of checkboxes. I had a similar problem the other day, and when this problem arose I was offered this

code: foreach ($_POST['checkboxname'] as $value) {
echo "$value " ;
}

This worked fine, but I cannot get it to work within my page that has mail() in it. I'm sure this is not right, but I put this entire code inline where I wanted the checkbox array to be displayed. Should I put foreach ($_POST['checkboxname'] as $value) somewhere else, and then just reference the array with $value inside the mail() code with the other variables? I did try this, but it didn't work for some reason.

My other thought was to escape out of "Message goes here", and just put html code in, but if I do this, I get no message content at all.

View Replies !
Adding Php Code Or To Include A Page With Php Code Into A .tpl Page
how would i do this, i am intergrating a phpbb forum system into my site!

View Replies !
Counter Script Inside Normal Html
I am trying to include a counter script inside normal html. I have my counter php script called counter.php i then have a index.html file that i would like to include the counter in. I have coded like this in the html file:

<?php include("counter.php"); ?>

If I run the counter.php page on it's own, it links to mysql and returns the desired result.

View Replies !
Inserting Adsense Code - Html Program That Automatically Coverts All My Text Files To Html Webpages?
I've purchased a text to html program that automatically coverts all my text files to html webpages within a template, but the only problem is how do I insert my adsense code into all 250 pages? I've seen articles regarding PHP includes for page templates, but I'm not sure how this would work inserting my code.

View Replies !
Converting FROM Html Entities Inside TEXT VALUE Parameter
I am experiencing some very odd behaviour using a function that converts from htmlentities unhtmlentites() - equivalent to pre-made html_entity_decode() in more recent versions of php. The function works fine, but when I echo inside a form, something goes wrong. Please look at the following code, in particular the output near the bottom.

This is a survey that saves form POST information in a mysql database, that is called back to the, rather long form, to show the user what they have already answered (by outputting answers back to the form). PHP Code:

View Replies !
Echo Result Set As HTML Image Source Inside Javascript
I'm attempting to echo an HTML table with images in one cell and data in the other.
The data shows fine but the images do not. When I view the echoed HTML source I have nothing between my "". Code:

View Replies !
Regex Question - Can't Get Unclosed Quote Marks Inside Of HTML Tags
I do not know much about regex.

I'm worried about lines like this:

<a href="myFile>my file</a>

There is only one quote mark in that html.

I wanted to fix this problem, so I tried this:

function command($string=false) {
$pattern = '/(.*)<a (.*)"(.*)>/i'
$replacement = '$1<$2"$3">'
$newString = preg_replace($pattern, $replacement, $string);
return $newString;
}

View Replies !
Display Values Of The Form Inside The Table On The New Page
I am generating data from database and displaying it inside input text boxes (for users to make some changes). What I need to do is when user presses "submit" button display all of the results inside the table on the new opened page. How can I do it?

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved