Jump to content

Recommended Posts

Hi, I'm having trouble using a css template.  It's not loading my header.html or footer.html  files.  Here is my code below and the error messages I receive.

 

<?php # Script 3.5 - calculator.php

$page_title = 'Widget Cost

Calculator';

include ('/includes/header.html');

if (isset($_POST['submitted'])) {

 

if ( is_numeric($_POST['quantity'])

&& is_numeric($_POST['price']) &&

is_numeric($_POST['tax']) ) {

 

$taxrate = $_POST['tax'] / 100;

$total = ($_POST['quantity'] *

$_POST['price']) * ($taxrate + 1);

 

echo '<h1 id="mainhead">Total Cost</h1>

<p>The total cost of purchasing ' .

$_POST['quantity'] . ' widget(s)

at $' . number_format ($_POST

['price'], 2) . ' each, including

a tax rate of ' . $_POST['tax'] .

'%, is $' . number_format ($total,

2) . '.</p><p><br/></p>';

 

} else {

echo '<h1

id="mainhead">Error!</h1>

<p class="error">Please enter

a valid quantity, price, and

tax.</p><p><br/></p>';

}

}

?>

 

<h2>Widget Cost Calculator</h2>

<form action="calculator.php"

method="post">

<p>Quantity: <input type="text"

name="quantity" size="5"

maxlength="10"/></p>

 

<p>Price: <input type="text"

name"price" size="5"

maxlength="10"/></p>

 

<p>Tax (%): <input type="text"

name="tax" size"5"

maxlength=10"/></p>

 

<p><input type"submit"

name="submit" value="Calculate!"/></p>

 

<input type="hidden"

name="submitted" value="TRUE"/>

</form>

 

<?php include ('./includes/footer.html');

 

?>

 

 

 

Error messages are as follows:

 

 

Warning:  include(./includes/header.html) [function.include]: failed to open stream: No such file or directory in C:\wamp\www\calculator.php on line 4

 

Warning:  include() [function.include]: Failed opening './includes/header.html' for inclusion (include_path='.;C:\php5\pear') in C:\wamp\www\calculator.php on line 4

 

Warning:  include(./includes/footer.html) [function.include]: failed to open stream: No such file or directory in C:\wamp\www\calculator.php on line 56

 

Warning:  include() [function.include]: Failed opening './includes/footer.html' for inclusion (include_path='.;C:\php5\pear') in C:\wamp\www\calculator.php on line 56

 

 

 

I use a program called WAMPSERVER which runs my apache, mysql and php.  It's located on the harddrive at C:\wamp\www and that's where all my files go into.  Not HTdocs.

 

Could someone please tell me what exactly to type to get my header.html and footer.html files to load?

 

 

Thank you and Merry Christmas!

Link to comment
https://forums.phpfreaks.com/topic/186258-php-css-help/
Share on other sites

Clue's in the error: failed to open stream: No such file or directory. You're using a mix of relative and absolute paths to include the files.

 

"./" = relative from the current directory

"/" = absolute/root path of the server

 

In respect to the file this code is in, where are the header and footer files stored?

 

By the way, placing your code within code tags makes it easier to read ;)

 

 

Link to comment
https://forums.phpfreaks.com/topic/186258-php-css-help/#findComment-983680
Share on other sites

Clue's in the error: failed to open stream: No such file or directory. You're using a mix of relative and absolute paths to include the files.

 

"./" = relative from the current directory

"/" = absolute/root path of the server

 

In respect to the file this code is in, where are the header and footer files stored?

 

By the way, placing your code within code tags makes it easier to read ;)

 

I apologize for not placing in the code tags.  The header and footer files are stored C:\wamp\www

 

 

Link to comment
https://forums.phpfreaks.com/topic/186258-php-css-help/#findComment-983690
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.