This include is not working in IE:
<?php
include_once 'localization.php';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Global Colleague</title>
<link href="css/style.css" rel="stylesheet" type="text/css"/><!--Start Kampyle Exit-Popup Code-->
<script type="text/javascript">
Calling an array inside localization.php
<?php echo l('content_p3'); ?>
EDIT: I tried the same file in another folder and it worked
"Not working" is very generic. What is it that you expect and what is actually happening? You may want to turn error reporting on and see if any error is reported. In (X)HTML, nothing should be printed before the doctype. Are you trying to add something to the HTTP response? Typically, the browser shouldn't effect how PHP outputs your code unless you've added some code to respond to the user agent which is not always wise.
Perhaps, when you tried your code in another directory it wasn't able to find the offending script as it is included by a relative path. Try removing the include in the original file and see if it "works".
The following way 100% work for you:
1) Install (Open Source) Notepad++ On your PC
2) Open the file in it
3) Go to encoding and select (Encode in UTF-8 Without BOM)
4) Then click save
5) Now it can work on (Chrome) and (IE)
:)
Related
I found a Webpage saved as something.php. But the source code tells me <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
I also found out that PHP code does not work on the webpage.
What is the need for making the file extension PHP if HTML is used?
(Not exactly HTML, but XHTML)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
What is the need for making the file extension PHP if HTML is used?
(Not exactly HTML, but XHTML)
Considering your comments so far, particularly you stated there is no PHP; you can just change the file extension to XHTML. You can always change it back.
I wonder what other PHP files exists where you "found" this page and why. Assuming someone before you developed the site, there is probably a reason they used PHP file extensions.
Unless your host doesn't support PHP, then you should be able to run php code anywhere on that page by placing it inside "" tags. The 'Content-type' isn't relevant to whether PHP can run or not. Try adding the following code somewhere in your page:
<?php echo "Hey there, I'm a friendly PHP string!"; ?>
add this <?php echo "Hello!"; ?> in your page to test, and make sure that your server is running, and normally it works
Are you using a wamp/mamp server? Have you tried to turn it on?
These code are meta tags
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
and it has nothing to do with php unless you have included a php script to it.
Html/XHtml will run even though you are not using a php server. All php files has a .php file extension and will run only if you use a server like wamp for windows or mamp for mac.
You can still use html/xhtml code in a .php file.
For example I have an <h1>This is h1</h1> tag and you want to make it dynamic, you can put <?php ?> inside the tag and echo it out to display, <h1><?php echo "This is h1"; ?></h1>.
In case you want to put html code inside a php script, you can do it like this
<?php echo "<h1>This is h1</h1>"; ?>
You can learn more about php and other programming languages by the help of google. Just take your time, relax and enjoy learning. Don't pressure yourself, remember learning is not a medicine that when you take it, it will work in a few minutes. Learning takes time and practice. Enjoy coding.
I have a piece of code in html and php for my index.php. This page is used for users to register. The users inserts its details and the registration process works successfully. The user can insert its details written in every language, and all characters are recognized and displayed in the right format. That works fine in localhost in my laptop using xampp. When I uploading my code to google cloud, however a problem occurs. If the user register himself with text lets say in Russian language, then in my database text stored in a strange format like & upsilon ; etc Probably the problem here is that when I upload my code to google cloud, not all language formats are read in the proper way. Any ideas on how to fix this?
This is my code:
<?php
include 'init.php';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="css/main.css" type="text/css">
<title> My page </title>
</head>
<body>
----------here is the form where the user register
</body>
</html>
my problem is that when a user
I'm not sure if this is programming-related enough for stack overflow, but anyways...
I want to change the code that is created in dreamweaver when you create a new HTML file or PHP file.
For example, I want to replace the default doctype and HTML tag:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
with this:
<!DOCTYPE html>
<html>
How can I do this?
On Mac OS X, you'll find Dreamweaver's Document Type Declaration configurations at:
/Applications/Adobe Dreamweaver/Configuration/DocumentTypes
To add a new template for HTML5 documents, open the file MMDocumentTypeDeclarations.xml and add a new element:
<documenttypedeclaration id="mm_html_5">
<title>
<MMString:loadString id="mmdocumenttypedeclarations/mm_html_5" />
</title>
<doctypedecl>
<![CDATA[<!DOCTYPE HTML>]]>
</doctypedecl>
<rootelement>
<![CDATA[<html></html>]]>
</rootelement>
<dtdcontext>html</dtdcontext>
<dtdcontext>html5</dtdcontext>
<dtdcontext>frameset_frame</dtdcontext>
<dtdcontext>xslt</dtdcontext>
</documenttypedeclaration>
When creating new documents, Dreamweaver references MMDocumentTypeDeclarations.xml and matches the <dtdcontext> against the Page Type you selected in the New Document dialog box.
By modifying this XML file, you don't have to edit any of the templates in:
/Applications/Adobe Dreamweaver/Configuration/DocumentTypes/NewDocuments
If you're running Dreamweaver CS5+ (version 11), Adobe already includes updated DTDs for HTML5:
Which creates the following blank document:
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<title>Untitled Document</title>
</head>
<body>
</body>
</html>
You can change which DOCTYPE is used by default when creating new documents by going into Dreamweaver's preferences:
In Windows, the file is at
C:\Program Files\Adobe\Adobe Dreamweaver CS3\configuration\DocumentTypes\NewDocuments\Default.html
Replace "CS3" with your Adobe CS version.
Still works in 2019 (using the subscription) in Win10:
C:\Program Files\Adobe\Adobe Dreamweaver CC 2019\configuration\DocumentTypes\NewDocuments
As explained here (PHP Include and accents (They show up as �)) php has a strange behavior processing the accents. My question is Why?
I mean: I have a simple utf-8 charset page. With this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>My Title</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
</head>
<body>
<?php include ('file.php');?>
The included file just says: "Administración." It has no charset, just header tags (h2, h3...), and some links. Like this:
<h2>Administración</h2>
So, there is no charset conflict. Are not they supposed that the include files are just included?
The previous question was answered with some fix to the problem, but my question is Why PHP behaves this way?
to answer you new questions (from your comment):
How can I do the same thing in other
editors, how do I know the default
charset?
default-charset and charset for every single file can be set in almost every code-editor i know - where exactly depends on the editor. simply take a look into the manual/documentation of your editor for that.
I have a test.php page
in this page , there is a url . i need to execute that url (here database updation is doing).This is my code
<?php
$username ='testUsername';
if($_GET['age']!=''){
header('location:www.test.com/update.php?age='.$_GET['age'].'&username='.$username); //need to updatethe age of this username
$show ='hello';
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<?php echo $show ?>
</body>
</html>
i know this code is not going to work properly.How can i write in a good way.I donot want to redirect the page.I just need to execute that link
Just call file_get_contents on the url in question instead of setting the location header to that value.
Since the update.php file is hosted on an external website, the only thing you can do is get the contents of the output of the file. (Use file_get_contents to get that output.) That is, it will call the file (with your parameters) and you can fetch the HTML result of it—nothing more. It would be a major security problem if server files could be executed on external websites.
If you need to include the code in update.php without redirecting, you can do so with the include or require functions.
require() is identical to include()
except upon failure it will ... halt
the script whereas include() only
emits a warning (E_WARNING) which
allows the script to continue.
Use the IMG tag. <img widht=0 height=0 src="<?='location:www.test.com/update.php?age='.$_GET['age'].'&username='.$username ?>" />