Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7961643
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T05:06:08+00:00 2026-06-04T05:06:08+00:00

My entire PHP page only displays as text and no PHP code is executed.

  • 0

My entire PHP page only displays as text and no PHP code is executed. It’s weird because when I test it using <? phpinfo(); ?> in a test.php file, I get a successful test and it works on my Apache server. However when I attempt to do anything else. It only shows as text.

Edit: Here is the link to the code. I couldn’t figure out how to post it here. Pastebin

<?php
  // create short variable names
  $tireqty = $_POST['tireqty'];
  $oilqty = $_POST['oilqty'];
  $sparkqty = $_POST['sparkqty'];
  $find = $_POST['find'];
?>
<html>
<head>
  <title>Bob's Auto Parts - Order Results</title>
</head>
<body>
<h1>Bob's Auto Parts</h1>
<h2>Order Results</h2>
<?php

    echo "<p>Order processed at ".date('H:i, jS F Y')."</p>";

    echo "<p>Your order is as follows: </p>";

    $totalqty = 0;
    $totalqty = $tireqty + $oilqty + $sparkqty;
    echo "Items ordered: ".$totalqty."<br />";


    if ($totalqty == 0) {

      echo "You did not order anything on the previous page!<br />";

    } else {

      if ($tireqty > 0) {
        echo $tireqty." tires<br />";
      }

      if ($oilqty > 0) {
        echo $oilqty." bottles of oil<br />";
      }

      if ($sparkqty > 0) {
        echo $sparkqty." spark plugs<br />";
      }
    }


    $totalamount = 0.00;

    define('TIREPRICE', 100);
    define('OILPRICE', 10);
    define('SPARKPRICE', 4);

    $totalamount = $tireqty * TIREPRICE
                 + $oilqty * OILPRICE
                 + $sparkqty * SPARKPRICE;

    echo "Subtotal: $".number_format($totalamount,2)."<br />";

    $taxrate = 0.10;  // local sales tax is 10%
    $totalamount = $totalamount * (1 + $taxrate);
    echo "Total including tax: $".number_format($totalamount,2)."<br />";

    if($find == "a") {
      echo "<p>Regular customer.</p>";
    } elseif($find == "b") {
      echo "<p>Customer referred by TV advert.</p>";
    } elseif($find == "c") {
      echo "<p>Customer referred by phone directory.</p>";
    } elseif($find == "d") {
      echo "<p>Customer referred by word of mouth.</p>";
    } else {
      echo "<p>We do not know how this customer found us.</p>";
    }

?>
</body>
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T05:06:09+00:00Added an answer on June 4, 2026 at 5:06 am

    I am willing to bet 10$ that test.php uses <?php, and the changed code uses <?, while the server does not understand it as an opening tag since short_open_tags is off in php.ini.

    A lot of books use <? for open tags, while most servers only support the long version (<?php). If that’s the case, then changing all the simple <? to <?php will do the trick.

    PHP code is only exposed in 1 case: When PHP interpreter does not identify it as PHP code. That can be caused by only 2 problems:

    • Wrong configuration of Apache (or other http server) which doesn’t handle php files at all.
    • Wrong open tags in PHP files, so PHP doesn’t know when code begins.

    If the file is a *.php, if Apache is turned on serving *.php files through PHP interpreter, if standard open tags are used or PHP is configured to use other types of used tags, and if you’re accessing this PHP file through the browser, in no circumstances would PHP expose this code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using PHP, is there a nice way to get the (parsed) introduction only from
this is my entire PHP code: <?php if(empty($_POST['selid'])) {echo no value selected; } else
Is there any way to upload an entire folder using PHP?
Edit: Entire page (HTML) <!doctype html> <html> <head> <meta charset=utf-8 /> <title>jQuery Ajax Test</title>
I'm trying to take an existing php file which I've built for a page
Is there any way I could, using only Javascript and HTML, have a page
I am trying to create a web page using php. The problem is that
This code reloads the entire page rather than simply replacing the #form element every
If I write an entire website in a single App class PHP file and
I am writing a php code that uses regex to get all the links

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.