Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP

Abe Layee
Abe Layee
8,378 Points

PHP External File

I don't what I am doing wrong here. I have a php file called order.php inside a php folder. For some reason, my order.php is not working. I am using the include method to link my file.

<body>
 <?php include 'php/processorder.php' ?> // here is the problem
   <form action="order.php" method="post">

       <table border="0">
            <tr id="bgcolor">
                <td class="width">Item</td>
                <td class="width">Quantity</td>
            </tr>
             <tr>
               <td>Tires </td>
             <td align="center"><input type="text" name="tireqty" size="3" maxlength="3"/></td>
            </tr>

            <tr>
                 <td>Oils</td>
                <td align="center"><input type="text" name="oilqty" size="3" maxlength="3"></td>
            </tr>

            <tr>
                <td>Spark Plugs</td>
                 <td align="center"><input type="text" size="3" maxlength="3"></td>
            </tr>

            <tr>
                <td colspan="2" align="center"><input type="submit" value="Sumit Order"/></td>
            </tr>
       </table>     
   </form>
</body>

3 Answers

Abe Layee
Abe Layee
8,378 Points

I figured it out and thank you for your help:D

There are many reasons that it might not work. They fall into 2 categories. Either the link is wrong or the code is wrong.

I usually test the link with something simple like this:

<?php
function hello() {
  return "Hello World";
}

// Main file below

Include 'filePath/name.php';
echo hello();

If that works, then you have a code problem. And looking at your code it does not appear that you do anything with the linked file. What are you trying to do?

Abe Layee
Abe Layee
8,378 Points

I am just practicing getting values from a form with php. I want my order.php to say thank for shopping at Bob's Auto shop.