473,396 Members | 1,996 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How to include PHP file in HTML

4
I'm trying to make a HTML page read a external PHP file with a variable:

File:

Expand|Select|Wrap|Line Numbers
  1. <?php
  2.     $email = "test@test.com"
  3. ?>
HTML:

Expand|Select|Wrap|Line Numbers
  1. <html>
  2.     <head>
  3.     </head>
  4.     <body>
  5.         <?php include ( "File1.php" ); ?>
  6.         The e-mail in the file is: <?php echo $_POST [ 'email' ] ?>
  7.     </body>
  8. </html>
It results:

"The e-mail in the file is:"

Nothings more, can anyone help me in this?

@Edit

Sorry for the wrong area, can any moderator move it?
Feb 26 '13 #1
3 1481
Dormilich
8,658 Expert Mod 8TB
moved to PHP forum.

you have a misconception is about $_POST and include.

in the $_POST array are variables that are passed from the requesting user agent via the HTTP POST method.

include simply imports a file into the current script.

if you resolve the include in your previous code, it would look like
Expand|Select|Wrap|Line Numbers
  1. <html>
  2.     <head>
  3.     </head>
  4.     <body>
  5.         <?php
  6.     $email = "test@test.com"; 
  7.         ?>
  8.         The e-mail in the file is: <?php echo $_POST [ 'email' ] ?>
  9.     </body>
  10. </html>
I think that should clear up things a bit.
Feb 26 '13 #2
los799
4
Ok, but if the var email is in a external php file, what should I do?
Feb 26 '13 #3
Dormilich
8,658 Expert Mod 8TB
external like on a different server?
Feb 26 '13 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: james | last post by:
I can't seem to access sessions variables from include files. If I use the include file like this it I cant get the session variables: <?php session_start(); require("url/to/inc/file.php");...
1
by: Susan Cranford | last post by:
I know this is simple but I'm new with it and can't see it. I am calling this sub from an ASP page right after the <html> tag as: <!-- #include file="genproc.inc"--> Then I call the sub below...
10
by: $kr1p7_k177y | last post by:
-Without using frames. -- .............................................................................. Chase after truth like hell and you'll free yourself, even though you never touch...
3
by: Adam | last post by:
Hi All, Is it possible to use includes dynamically in html. Hopefully the following example will give an idea what I am rying to do. Thanks in advance Adam <script language="javascript">
3
by: TNG | last post by:
Hi, I try to accomplish something like this: <!--#include file="menu_<%response.write (strproduct)%>.html"--> But unfortunally, I quess there is something with my syntax... any idea ?
2
by: finlab_it | last post by:
I need to build a site with pages based on a common layout. This layout may change in the time. To avoid extra-works and/or lack of quality, It would be interesting to have an embed/include tag...
1
by: Grey | last post by:
Dear all I need to include some predefined file in ASP.NET like ASP. The statement for file include is "<!-- #INCLUDE FILE="ABC.ASP" -->" in ASP, but what is it in ASP.NET??
3
by: Dave Kelly | last post by:
Given this html code page; ======begin <html> <body> <!--#include file="outing.1.shtml"--> <form action="form.php" method="GET"> <input type="hidden" name="op" value="ds"> <table width="468"...
14
by: Michael | last post by:
Since the include function is called from within a PHP script, why does the included file have to identify itself as a PHP again by enclosing its code in <?php... <?> One would assume that the...
1
by: shank | last post by:
I have the below code to auto-email a customer. What is the syntax to include a file in the email? <!--#include file="agreement_inc.asp" --> HTML = HTML & "...just some text...<br>" HTML =...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.