473,399 Members | 4,192 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,399 software developers and data experts.

HTML call

Pat
Hello,

I have a question in regards to the use of php and html. The question
is: can someone write a script separate from the html page and then call
the script in like in a css style and use the values in the html page?
If so how?

I am just learning php and am not ignorant to programming, but I would
use a function or created class in the separate file but how would you
call the php file into the html file is what's killing me.

I hope that makes sense and I hope someone can at least point me in the
right direction to find the answer; because, to me putting all the code
in an html document is redundant especially on the oop side.

Thank you,
Patrick
Jul 24 '06 #1
5 15675

Pat wrote:
Hello,

I have a question in regards to the use of php and html. The question
is: can someone write a script separate from the html page and then call
the script in like in a css style and use the values in the html page?
If so how?

I am just learning php and am not ignorant to programming, but I would
use a function or created class in the separate file but how would you
call the php file into the html file is what's killing me.

I hope that makes sense and I hope someone can at least point me in the
right direction to find the answer; because, to me putting all the code
in an html document is redundant especially on the oop side.

Thank you,
Patrick
You can include an html page into you php file, just by doing
include("file.ext"); you can't call php into html, im not sure exactly
what you mean by use the values in the html.. you can set a variable in
php, include an html page and within that html page have <input
type='name' value=' <?php echo $something; ?>'>

Flamer.

Jul 24 '06 #2
Pat wrote:
Hello,

I have a question in regards to the use of php and html. The question
is: can someone write a script separate from the html page and then call
the script in like in a css style and use the values in the html page?
If so how?

I am just learning php and am not ignorant to programming, but I would
use a function or created class in the separate file but how would you
call the php file into the html file is what's killing me.

I hope that makes sense and I hope someone can at least point me in the
right direction to find the answer; because, to me putting all the code
in an html document is redundant especially on the oop side.

Thank you,
Patrick
Easy way:
Write all your php code and require the html file
# test.php
<?php
$test = "Hi there";
require_once( 'test.html' );
exit(); // stop execution of script
?>

#test.html
<html>
<body>
<?php echo $test ?>
</body>
</html>

Little more complicated, but worth it if you want to get into
professional PHP development.
Smarty - PHP templating engine
http://smarty.php.net

1. Allows for logic in the template - Seperation of template logic and
business logic
2. Template caching
3. Many more benefits, check out the documentation

Jul 24 '06 #3
Pat wrote:
Hello,

I have a question in regards to the use of php and html. The question
is: can someone write a script separate from the html page and then call
the script in like in a css style and use the values in the html page?
If so how?

I am just learning php and am not ignorant to programming, but I would
use a function or created class in the separate file but how would you
call the php file into the html file is what's killing me.

I hope that makes sense and I hope someone can at least point me in the
right direction to find the answer; because, to me putting all the code
in an html document is redundant especially on the oop side.

Thank you,
Patrick
From HTML you can include a PHP file with SSI - Server Side Includes, i..e

<!-- include file="myfile.php" -->

See SSI documentation for your server for more information and/or follow
up in alt.html.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Jul 25 '06 #4
reb


Le 24/07/2006 23:43, Pat a écrit :
I have a question in regards to the use of php and html. The question
is: can someone write a script separate from the html page and then call
the script in like in a css style and use the values in the html page?
If so how?

I am just learning php and am not ignorant to programming, but I would
use a function or created class in the separate file but how would you
call the php file into the html file is what's killing me.

I hope that makes sense and I hope someone can at least point me in the
right direction to find the answer; because, to me putting all the code
in an html document is redundant especially on the oop side.
You can call a php script from your HTML with an inline frame ; you'll
get the generated content of the php file :

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Test</title>
</head>
<body>
<p>Lorem ipsum...
<iframe src="test.php"></iframe>
</body>
</html>
Jul 26 '06 #5
Pat
Pat wrote:
Hello,

I have a question in regards to the use of php and html. The question
is: can someone write a script separate from the html page and then call
the script in like in a css style and use the values in the html page?
If so how?

I am just learning php and am not ignorant to programming, but I would
use a function or created class in the separate file but how would you
call the php file into the html file is what's killing me.

I hope that makes sense and I hope someone can at least point me in the
right direction to find the answer; because, to me putting all the code
in an html document is redundant especially on the oop side.

Thank you,
Patrick
Thank you everyone this helps me a lot.

Thank you again,
Patrick
Jul 26 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
by: deko | last post by:
Is it possible to call a php script from an html page? I have a TestPage.php that I want to convert to TestPage.html - but still call a php script from it. This is how my TestPage.php looks...
4
by: Fergus O'Shea | last post by:
I have some text that appears in a Database. This text includes HTML(e.g. <br> tags). I also have a Webpage that makes an XML call to that database. But when the text is displayed on the page,...
4
by: CLEAR-RCIC | last post by:
A person in a different division where I work asked for some help. He has an HTML website and wants to use some functionality in a .Net .dll that I've developed. I currently use this...
9
by: Robby Bankston | last post by:
I'm working on some code and am running into brick walls. I'm trying to write out Javascript with Javascript and I've read the clj Meta FAQ and didn't see the answer, read many similar posts (with...
3
by: Epetruk | last post by:
Hi, I'm looking for samples of ASP.NET projects where the programming has been done almost entirely using codebehind and classes with very little code in the aspx files themselves. I would...
5
by: Andy G | last post by:
I have many html pages that I need to put a button on. When this button is clicked I need to call a stored procedure that updates a record. -How do I add a button to html page that will call a...
0
by: bp_jobemail | last post by:
I'm trying to use PHP to wrap the output of an HTML form before it goes into a precompiled C cgi script. Essentially, the company that I work for uses a purchased precompiled c program for their...
3
by: Chuck Renner | last post by:
Please help! This MIGHT even be a bug in PHP! I'll provide version numbers and site specific information (browser, OS, and kernel versions) if others cannot reproduce this problem. I'm...
19
by: thisis | last post by:
Hi All, i have this.asp page: <script type="text/vbscript"> Function myFunc(val1ok, val2ok) ' do something ok myFunc = " return something ok" End Function </script>
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.