php-lampp-ubuntu: include function doesn't workstartsWith() and endsWith() functions in PHPHow does PHP 'foreach' actually work?Why shouldn't I use mysql_* functions in PHP?How do I fix Undefined variable error in PHP?Creating a foreach loop to cache html form name in php variablesPHP error: Notice: Undefined offsetcant run my projectActionScripts 3 to PHP email sendProblems with arrays: Notice: Undefined offset: 0sum php multi dimensional array by index value

Is it possible to use .desktop files to open local pdf files on specific pages with a browser?

Do the concepts of IP address and network interface not belong to the same layer?

How do ground effect vehicles perform turns?

Query about absorption line spectra

Could the E-bike drivetrain wear down till needing replacement after 400 km?

What is the gram­mat­i­cal term for “‑ed” words like these?

Why has "pence" been used in this sentence, not "pences"?

Should I install hardwood flooring or cabinets first?

Will adding a BY-SA image to a blog post make the entire post BY-SA?

What does the Rambam mean when he says that the planets have souls?

How much character growth crosses the line into breaking the character

Global amount of publications over time

Engineer refusing to file/disclose patents

How to color a curve

Reply 'no position' while the job posting is still there

Why did the EU agree to delay the Brexit deadline?

Freedom of speech and where it applies

A Permanent Norse Presence in America

Using a siddur to Daven from in a seforim store

Two-sided logarithm inequality

Is XSS in canonical link possible?

Why is Arduino resetting while driving motors?

Greatest common substring

Some numbers are more equivalent than others



php-lampp-ubuntu: include function doesn't work


startsWith() and endsWith() functions in PHPHow does PHP 'foreach' actually work?Why shouldn't I use mysql_* functions in PHP?How do I fix Undefined variable error in PHP?Creating a foreach loop to cache html form name in php variablesPHP error: Notice: Undefined offsetcant run my projectActionScripts 3 to PHP email sendProblems with arrays: Notice: Undefined offset: 0sum php multi dimensional array by index value













-1















I'm trying to learn include function but it doesn't seem to work, here is my code.



The file count.html.php:



<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<title>Counting to ten</title>
</head>
<body>
<p>
<?php echo $output; ?>
</p>
</body>
</html>


And this is my count.php:



<?php
$output = '';
for($count = 1; $count <= 10; $count++)

$output .= $count . ' ';


include './count.html.php';
?>


both are in the same directory



/opt/lampp/htdocs


the error on the browser




Notice: Undefined variable: output in /opt/lampp/htdocs/count.html.php on line 9











share|improve this question
























  • What are errors you are getting?

    – RopAli Munshi
    Mar 8 at 6:49











  • Notice: Undefined variable: output in /opt/lampp/htdocs/count.html.php on line 9

    – Rabi Laadid
    Mar 8 at 6:51











  • Please show us the contents of count.html.php (the relevant contents , like line 9 and the code related to that line).

    – Magnus Eriksson
    Mar 8 at 6:58







  • 1





    @ChanjungKim - Some developers prefer foo.html.php when the file also contains HTML and use foo.php if the file only contains PHP. That's just a matter of opinion and is off-topic for this issue.

    – Magnus Eriksson
    Mar 8 at 7:17






  • 1





    @ChanjungKim I have changed the extension of the count.html.php to count2.php and also the value of the include to 'count2.php' and they are in the same directory but I'm still getting the same issue

    – Rabi Laadid
    Mar 8 at 7:23















-1















I'm trying to learn include function but it doesn't seem to work, here is my code.



The file count.html.php:



<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<title>Counting to ten</title>
</head>
<body>
<p>
<?php echo $output; ?>
</p>
</body>
</html>


And this is my count.php:



<?php
$output = '';
for($count = 1; $count <= 10; $count++)

$output .= $count . ' ';


include './count.html.php';
?>


both are in the same directory



/opt/lampp/htdocs


the error on the browser




Notice: Undefined variable: output in /opt/lampp/htdocs/count.html.php on line 9











share|improve this question
























  • What are errors you are getting?

    – RopAli Munshi
    Mar 8 at 6:49











  • Notice: Undefined variable: output in /opt/lampp/htdocs/count.html.php on line 9

    – Rabi Laadid
    Mar 8 at 6:51











  • Please show us the contents of count.html.php (the relevant contents , like line 9 and the code related to that line).

    – Magnus Eriksson
    Mar 8 at 6:58







  • 1





    @ChanjungKim - Some developers prefer foo.html.php when the file also contains HTML and use foo.php if the file only contains PHP. That's just a matter of opinion and is off-topic for this issue.

    – Magnus Eriksson
    Mar 8 at 7:17






  • 1





    @ChanjungKim I have changed the extension of the count.html.php to count2.php and also the value of the include to 'count2.php' and they are in the same directory but I'm still getting the same issue

    – Rabi Laadid
    Mar 8 at 7:23













-1












-1








-1








I'm trying to learn include function but it doesn't seem to work, here is my code.



The file count.html.php:



<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<title>Counting to ten</title>
</head>
<body>
<p>
<?php echo $output; ?>
</p>
</body>
</html>


And this is my count.php:



<?php
$output = '';
for($count = 1; $count <= 10; $count++)

$output .= $count . ' ';


include './count.html.php';
?>


both are in the same directory



/opt/lampp/htdocs


the error on the browser




Notice: Undefined variable: output in /opt/lampp/htdocs/count.html.php on line 9











share|improve this question
















I'm trying to learn include function but it doesn't seem to work, here is my code.



The file count.html.php:



<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<title>Counting to ten</title>
</head>
<body>
<p>
<?php echo $output; ?>
</p>
</body>
</html>


And this is my count.php:



<?php
$output = '';
for($count = 1; $count <= 10; $count++)

$output .= $count . ' ';


include './count.html.php';
?>


both are in the same directory



/opt/lampp/htdocs


the error on the browser




Notice: Undefined variable: output in /opt/lampp/htdocs/count.html.php on line 9








php






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 8 at 7:36







Rabi Laadid

















asked Mar 8 at 6:48









Rabi LaadidRabi Laadid

14




14












  • What are errors you are getting?

    – RopAli Munshi
    Mar 8 at 6:49











  • Notice: Undefined variable: output in /opt/lampp/htdocs/count.html.php on line 9

    – Rabi Laadid
    Mar 8 at 6:51











  • Please show us the contents of count.html.php (the relevant contents , like line 9 and the code related to that line).

    – Magnus Eriksson
    Mar 8 at 6:58







  • 1





    @ChanjungKim - Some developers prefer foo.html.php when the file also contains HTML and use foo.php if the file only contains PHP. That's just a matter of opinion and is off-topic for this issue.

    – Magnus Eriksson
    Mar 8 at 7:17






  • 1





    @ChanjungKim I have changed the extension of the count.html.php to count2.php and also the value of the include to 'count2.php' and they are in the same directory but I'm still getting the same issue

    – Rabi Laadid
    Mar 8 at 7:23

















  • What are errors you are getting?

    – RopAli Munshi
    Mar 8 at 6:49











  • Notice: Undefined variable: output in /opt/lampp/htdocs/count.html.php on line 9

    – Rabi Laadid
    Mar 8 at 6:51











  • Please show us the contents of count.html.php (the relevant contents , like line 9 and the code related to that line).

    – Magnus Eriksson
    Mar 8 at 6:58







  • 1





    @ChanjungKim - Some developers prefer foo.html.php when the file also contains HTML and use foo.php if the file only contains PHP. That's just a matter of opinion and is off-topic for this issue.

    – Magnus Eriksson
    Mar 8 at 7:17






  • 1





    @ChanjungKim I have changed the extension of the count.html.php to count2.php and also the value of the include to 'count2.php' and they are in the same directory but I'm still getting the same issue

    – Rabi Laadid
    Mar 8 at 7:23
















What are errors you are getting?

– RopAli Munshi
Mar 8 at 6:49





What are errors you are getting?

– RopAli Munshi
Mar 8 at 6:49













Notice: Undefined variable: output in /opt/lampp/htdocs/count.html.php on line 9

– Rabi Laadid
Mar 8 at 6:51





Notice: Undefined variable: output in /opt/lampp/htdocs/count.html.php on line 9

– Rabi Laadid
Mar 8 at 6:51













Please show us the contents of count.html.php (the relevant contents , like line 9 and the code related to that line).

– Magnus Eriksson
Mar 8 at 6:58






Please show us the contents of count.html.php (the relevant contents , like line 9 and the code related to that line).

– Magnus Eriksson
Mar 8 at 6:58





1




1





@ChanjungKim - Some developers prefer foo.html.php when the file also contains HTML and use foo.php if the file only contains PHP. That's just a matter of opinion and is off-topic for this issue.

– Magnus Eriksson
Mar 8 at 7:17





@ChanjungKim - Some developers prefer foo.html.php when the file also contains HTML and use foo.php if the file only contains PHP. That's just a matter of opinion and is off-topic for this issue.

– Magnus Eriksson
Mar 8 at 7:17




1




1





@ChanjungKim I have changed the extension of the count.html.php to count2.php and also the value of the include to 'count2.php' and they are in the same directory but I'm still getting the same issue

– Rabi Laadid
Mar 8 at 7:23





@ChanjungKim I have changed the extension of the count.html.php to count2.php and also the value of the include to 'count2.php' and they are in the same directory but I'm still getting the same issue

– Rabi Laadid
Mar 8 at 7:23












1 Answer
1






active

oldest

votes


















0














If you read your error message carefully, it points you at the line 9 of the file count.html.php (obviously because you have less than 9 lines in count.php).



That means either that



  • the code you show us is not the actual code you test... then we really cannot help

  • you access the wrong file

It is just impossible that the include fails, as you think, you have to rethink that hypothesis



If you get this error accessing count.php that means the include worked because the error points at the line 9 of a file that have less than 9 lines, so it points at the line 9 of the included file.



Most likely your are trying to access the file count.html.php directly from your browser, when you actually meant to access the other file count.php, the one that defines the variable $output






share|improve this answer

























  • That's exaclty what I'm trying to do, but the function "include" doesn't seem to work

    – Rabi Laadid
    Mar 8 at 7:35











  • No. There is no line 9 on the pure PHP file (cf your error) that means that you are accessing the wrong file

    – b.enoit.be
    Mar 8 at 7:36











  • it refers to the line in the first file count.html.php where it declares the variable output, the only problem that varial get its definition from count.php. sorry if I can't clarify my problem properly, I'm still new to php

    – Rabi Laadid
    Mar 8 at 7:45











  • Read the answer again and rethink your hypothesis. If you stick yourself to the ”the include do not work“ one, you are loosing your time and won’t find your issue nor will you be able to explain it for us to help you

    – b.enoit.be
    Mar 8 at 7:52











  • Thank you so much now I get it, I was trying to access count.php from the html file since I thougth html is the file meant to deal with the browser.

    – Rabi Laadid
    Mar 8 at 7:56










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55058080%2fphp-lampp-ubuntu-include-function-doesnt-work%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














If you read your error message carefully, it points you at the line 9 of the file count.html.php (obviously because you have less than 9 lines in count.php).



That means either that



  • the code you show us is not the actual code you test... then we really cannot help

  • you access the wrong file

It is just impossible that the include fails, as you think, you have to rethink that hypothesis



If you get this error accessing count.php that means the include worked because the error points at the line 9 of a file that have less than 9 lines, so it points at the line 9 of the included file.



Most likely your are trying to access the file count.html.php directly from your browser, when you actually meant to access the other file count.php, the one that defines the variable $output






share|improve this answer

























  • That's exaclty what I'm trying to do, but the function "include" doesn't seem to work

    – Rabi Laadid
    Mar 8 at 7:35











  • No. There is no line 9 on the pure PHP file (cf your error) that means that you are accessing the wrong file

    – b.enoit.be
    Mar 8 at 7:36











  • it refers to the line in the first file count.html.php where it declares the variable output, the only problem that varial get its definition from count.php. sorry if I can't clarify my problem properly, I'm still new to php

    – Rabi Laadid
    Mar 8 at 7:45











  • Read the answer again and rethink your hypothesis. If you stick yourself to the ”the include do not work“ one, you are loosing your time and won’t find your issue nor will you be able to explain it for us to help you

    – b.enoit.be
    Mar 8 at 7:52











  • Thank you so much now I get it, I was trying to access count.php from the html file since I thougth html is the file meant to deal with the browser.

    – Rabi Laadid
    Mar 8 at 7:56















0














If you read your error message carefully, it points you at the line 9 of the file count.html.php (obviously because you have less than 9 lines in count.php).



That means either that



  • the code you show us is not the actual code you test... then we really cannot help

  • you access the wrong file

It is just impossible that the include fails, as you think, you have to rethink that hypothesis



If you get this error accessing count.php that means the include worked because the error points at the line 9 of a file that have less than 9 lines, so it points at the line 9 of the included file.



Most likely your are trying to access the file count.html.php directly from your browser, when you actually meant to access the other file count.php, the one that defines the variable $output






share|improve this answer

























  • That's exaclty what I'm trying to do, but the function "include" doesn't seem to work

    – Rabi Laadid
    Mar 8 at 7:35











  • No. There is no line 9 on the pure PHP file (cf your error) that means that you are accessing the wrong file

    – b.enoit.be
    Mar 8 at 7:36











  • it refers to the line in the first file count.html.php where it declares the variable output, the only problem that varial get its definition from count.php. sorry if I can't clarify my problem properly, I'm still new to php

    – Rabi Laadid
    Mar 8 at 7:45











  • Read the answer again and rethink your hypothesis. If you stick yourself to the ”the include do not work“ one, you are loosing your time and won’t find your issue nor will you be able to explain it for us to help you

    – b.enoit.be
    Mar 8 at 7:52











  • Thank you so much now I get it, I was trying to access count.php from the html file since I thougth html is the file meant to deal with the browser.

    – Rabi Laadid
    Mar 8 at 7:56













0












0








0







If you read your error message carefully, it points you at the line 9 of the file count.html.php (obviously because you have less than 9 lines in count.php).



That means either that



  • the code you show us is not the actual code you test... then we really cannot help

  • you access the wrong file

It is just impossible that the include fails, as you think, you have to rethink that hypothesis



If you get this error accessing count.php that means the include worked because the error points at the line 9 of a file that have less than 9 lines, so it points at the line 9 of the included file.



Most likely your are trying to access the file count.html.php directly from your browser, when you actually meant to access the other file count.php, the one that defines the variable $output






share|improve this answer















If you read your error message carefully, it points you at the line 9 of the file count.html.php (obviously because you have less than 9 lines in count.php).



That means either that



  • the code you show us is not the actual code you test... then we really cannot help

  • you access the wrong file

It is just impossible that the include fails, as you think, you have to rethink that hypothesis



If you get this error accessing count.php that means the include worked because the error points at the line 9 of a file that have less than 9 lines, so it points at the line 9 of the included file.



Most likely your are trying to access the file count.html.php directly from your browser, when you actually meant to access the other file count.php, the one that defines the variable $output







share|improve this answer














share|improve this answer



share|improve this answer








edited Mar 9 at 21:44

























answered Mar 8 at 7:30









b.enoit.beb.enoit.be

5,14842842




5,14842842












  • That's exaclty what I'm trying to do, but the function "include" doesn't seem to work

    – Rabi Laadid
    Mar 8 at 7:35











  • No. There is no line 9 on the pure PHP file (cf your error) that means that you are accessing the wrong file

    – b.enoit.be
    Mar 8 at 7:36











  • it refers to the line in the first file count.html.php where it declares the variable output, the only problem that varial get its definition from count.php. sorry if I can't clarify my problem properly, I'm still new to php

    – Rabi Laadid
    Mar 8 at 7:45











  • Read the answer again and rethink your hypothesis. If you stick yourself to the ”the include do not work“ one, you are loosing your time and won’t find your issue nor will you be able to explain it for us to help you

    – b.enoit.be
    Mar 8 at 7:52











  • Thank you so much now I get it, I was trying to access count.php from the html file since I thougth html is the file meant to deal with the browser.

    – Rabi Laadid
    Mar 8 at 7:56

















  • That's exaclty what I'm trying to do, but the function "include" doesn't seem to work

    – Rabi Laadid
    Mar 8 at 7:35











  • No. There is no line 9 on the pure PHP file (cf your error) that means that you are accessing the wrong file

    – b.enoit.be
    Mar 8 at 7:36











  • it refers to the line in the first file count.html.php where it declares the variable output, the only problem that varial get its definition from count.php. sorry if I can't clarify my problem properly, I'm still new to php

    – Rabi Laadid
    Mar 8 at 7:45











  • Read the answer again and rethink your hypothesis. If you stick yourself to the ”the include do not work“ one, you are loosing your time and won’t find your issue nor will you be able to explain it for us to help you

    – b.enoit.be
    Mar 8 at 7:52











  • Thank you so much now I get it, I was trying to access count.php from the html file since I thougth html is the file meant to deal with the browser.

    – Rabi Laadid
    Mar 8 at 7:56
















That's exaclty what I'm trying to do, but the function "include" doesn't seem to work

– Rabi Laadid
Mar 8 at 7:35





That's exaclty what I'm trying to do, but the function "include" doesn't seem to work

– Rabi Laadid
Mar 8 at 7:35













No. There is no line 9 on the pure PHP file (cf your error) that means that you are accessing the wrong file

– b.enoit.be
Mar 8 at 7:36





No. There is no line 9 on the pure PHP file (cf your error) that means that you are accessing the wrong file

– b.enoit.be
Mar 8 at 7:36













it refers to the line in the first file count.html.php where it declares the variable output, the only problem that varial get its definition from count.php. sorry if I can't clarify my problem properly, I'm still new to php

– Rabi Laadid
Mar 8 at 7:45





it refers to the line in the first file count.html.php where it declares the variable output, the only problem that varial get its definition from count.php. sorry if I can't clarify my problem properly, I'm still new to php

– Rabi Laadid
Mar 8 at 7:45













Read the answer again and rethink your hypothesis. If you stick yourself to the ”the include do not work“ one, you are loosing your time and won’t find your issue nor will you be able to explain it for us to help you

– b.enoit.be
Mar 8 at 7:52





Read the answer again and rethink your hypothesis. If you stick yourself to the ”the include do not work“ one, you are loosing your time and won’t find your issue nor will you be able to explain it for us to help you

– b.enoit.be
Mar 8 at 7:52













Thank you so much now I get it, I was trying to access count.php from the html file since I thougth html is the file meant to deal with the browser.

– Rabi Laadid
Mar 8 at 7:56





Thank you so much now I get it, I was trying to access count.php from the html file since I thougth html is the file meant to deal with the browser.

– Rabi Laadid
Mar 8 at 7:56



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55058080%2fphp-lampp-ubuntu-include-function-doesnt-work%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Can't initialize raids on a new ASUS Prime B360M-A motherboard2019 Community Moderator ElectionSimilar to RAID config yet more like mirroring solution?Can't get motherboard serial numberWhy does the BIOS entry point start with a WBINVD instruction?UEFI performance Asus Maximus V Extreme

Identity Server 4 is not redirecting to Angular app after login2019 Community Moderator ElectionIdentity Server 4 and dockerIdentityserver implicit flow unauthorized_clientIdentityServer Hybrid Flow - Access Token is null after user successful loginIdentity Server to MVC client : Page Redirect After loginLogin with Steam OpenId(oidc-client-js)Identity Server 4+.NET Core 2.0 + IdentityIdentityServer4 post-login redirect not working in Edge browserCall to IdentityServer4 generates System.NullReferenceException: Object reference not set to an instance of an objectIdentityServer4 without HTTPS not workingHow to get Authorization code from identity server without login form

2005 Ahvaz unrest Contents Background Causes Casualties Aftermath See also References Navigation menue"At Least 10 Are Killed by Bombs in Iran""Iran"Archived"Arab-Iranians in Iran to make April 15 'Day of Fury'"State of Mind, State of Order: Reactions to Ethnic Unrest in the Islamic Republic of Iran.10.1111/j.1754-9469.2008.00028.x"Iran hangs Arab separatists"Iran Overview from ArchivedConstitution of the Islamic Republic of Iran"Tehran puzzled by forged 'riots' letter""Iran and its minorities: Down in the second class""Iran: Handling Of Ahvaz Unrest Could End With Televised Confessions""Bombings Rock Iran Ahead of Election""Five die in Iran ethnic clashes""Iran: Need for restraint as anniversary of unrest in Khuzestan approaches"Archived"Iranian Sunni protesters killed in clashes with security forces"Archived