How to make php file show in browser - php

I have an html file called enter.html and php file called form.php .My php file does not contain any html tag. And I posted my form infos through post method php proceeds it but php file does not show in browser . It directly downloads itsel automatically.Why? But If I take php scripts into html tag the file shows in browser.

This might be usefull.
Is your server turned on?
http://www.php.net/manual/en/tutorial.firstpage.php

Related

GAE - Cannot get html content from PHP "include" to show up, no console output

Using Google App Engine, I'm trying to display a PHP page that contains html, within which I have more html content from another source. I'm using a PHP tag to include the content, like so:
< ?php include "https://myfileURL.html"; ?>
But it does not show up in the page source code. The html file is in a "/HTML/" folder which is handled as a static_dir in app.yaml. I can access the URL from the browser and the content is there, but if I put that URL in the include tag I get nothing. I can even put bad URLs and I get no errors, no console output... just nothing. The page displays with white space in the middle of the source code.
Any idea what's going on here? Everything works perfectly in localhost.
Argh... backend process... need to catch errors in php, nevermind.

How to print an html file with textarea in it into another textarea without being parsed by the browser?

I want to edit my php or html files on the server without logging in. I wrote a php file to import the file contents that I want to edit. The file contents will be printed in a textarea.
It does work. But, when I import a file with textarea, the browser parses the </textarea> from the file as its end part of the textarea. And the rest parts after will also be parsed, too.
Is there any methods to prevent the browser from parsing the file?
The HTML inside your textarea needs to use HTML Entities instead of the actual symbols. That way it won't be parsed.. so that's something like this:
<html> ... </html> <!-- no entities -->
<html> ... </html> <!-- entities -->
I bet there's a lot of functions that can help you with this, like htmlentities() or some JavaScript equivalent, that link leads to css-tricks where a really simple JS one is. JS doesn't have a native one, afaik.
Your PHP mustn't be executed, but as Progman stated:
When the source code is added to the content of the textarea (with
functions like file_get_contents()), it is not parsed by the PHP
interpreter. So it is not required to switch to a .html file to
prevent any PHP executions (there is none).
So, that solves this issue.

embed a php file from external site, just as text / html

I have a php file on a website (example: https://www.site1.com/script.php).
This script outputs some html, basically just text formatted with <h2>, <p> and so on.
I need to put this text inside a div, in a remote web page on another site (example: https://www.site2.com/page.php), then style it with css.
I don't need to load or execute script.php code, but just its "output", as you can see opening the php file from the browser
Alternative solutions than using "include" and allow_url_include in the php.ini?
just used:
echo file_get_contents("https://www.site1.com/script.php");

Grabbing only HTML div from php file through jQuery GET

I have a PHP file which might contain lot of PHP tags, scripts and HTML.
I need to get only HTML div inside the php file. The file contain lot of <?php > tags. I want to ignore those tags and to get only HTML from the page using jQuery.get().
Is it possible to do this?
When you open a .php file in your browser, the server executes the PHP files and only gives HTML (+javascipt +css) back. JavaScript is then executed in your browser and you won't have any <?php ?> tags inside. Therefore you can simply use jQuery selectors.

Modernizr With Codeigniter

I am having difficulty trying to get modernizer to run with codeigniter.
this is what I've done so far.
downloaded Modernizr and renamed the file modernizr-1.5.min.txt to modernizr-1.5.min.js
put the JavaScript file in the same directory as my header file is: apppath/views/tops/
included the file in my headings <script src="modernizr-1.5.min.js"></script>
included this in my HTML element <html class="no-js">
just to preserve my sanity I put the JavaScript file modernizr-1.5.min.js in my views directory and in the application directory.
I am getting absolutely zero response when I read my page source to see if the has been replaced with the elements that my browser covers the wave modernizr is supposed to work. I have tried this using Firefox and chrome as far as reading the source.
any suggestions? Thank you in advance
why would you put javascript files ito the view folder of your app? i would rather use this path "/media/javascripts/modernizr.js" and then <script src="/media/javascripts/modernizr.js"></script> link it like that. the view folder is only for templates. other thing is that you will never see the changes that javascript does to your page in the pagesource. because it only shows you what html the browser received. and javascript starts to work after the browser received the html. you need to install firebug to see the "live" dom.

Categories