473,394 Members | 1,742 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,394 software developers and data experts.

HTML file generation with PHP.

Q
Hi,

I would like to create the following very simple (I think) web page.
Any visitor in an text field can type same text and press button
"Send". After this message of visitor have to be printed out below of
the text field (somethink like guest book). Of course I can do it like
this:

<form method="get">
<input type=text name="x" value="">
<input type=submit value="Submit">
</form>
<?php echo $x ?>

However, there are several disadvantages of this solution. I need that
all visitors are able to read messages leaved by another visitors as
well as messages leaved same time ago. So I think it is not reasonable
to save all leaved messages as values of variables. It would be better
to add messages to some existing html file. Do you know how one can do
it?
Jul 17 '05 #1
4 1940
http://us2.php.net/manual/en/function.fwrite.php
The fwrite() function can write to files....

Jul 17 '05 #2
http://us2.php.net/manual/en/function.fwrite.php
The fwrite() function can write to files....

Jul 17 '05 #3
Q
> The fwrite() function can write to files....
Ok. I have composed a php file (add.php) which can add a chosen by
user text to an existing html file (animal.html). However I am not
shure that it has been done in an elegant way. My problem was that
before adding some text to the html file I need remove and of this
file and that add this and again. My solution is:

======================== add.php ============================
<html>
<body>
<form method="get">
<input type=text name="x" value="" size="20">
<input type=submit value="Submit">
</form>
<?php
$filename = 'body.html';
$somecontent = $x;
fopen($filename, 'a');
fwrite($handle, $somecontent) === FALSE);
fwrite($handle,"\n <P>");
fclose($handle);
system("cat head.html > animal.html");
system("cat body.html >> animal.html");
system("cat tail.html >> animal.html");
?>
</html>

======================== head.html =============================
<html>
<head>
<title></title>
</head>
<body bgcolor="#6495ED">

======================== tail.html ==============================
<FORM ACTION="add.php" METHOD="GET">
<INPUT TYPE="SUBMIT" VALUE="Add message">
</FORM>
</html>

Is it good a solution? :)
Jul 17 '05 #4
In article <5f**************************@posting.google.com >,
op*********@yahoo.com (Q) wrote:

:Is it good a solution? :)

Take a look at the heredoc syntax:
http://ca.php.net/manual/en/language.types.string.php
--
Looks like more of Texas to me.
.... Arizona, where the nights are warm and the roads are straight.
Jul 17 '05 #5

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

Similar topics

1
by: max | last post by:
Hi all, I am looking for a recent rundown of HTML generation frameworks rated by 1) being up-to date 2) power 3) complexity and more informally - what do python folks like to use for HTML...
8
by: Bri | last post by:
Greetings, After making various edits and deletes on aproximately 40,000 records in one table (on the Design Master) syncronization fails with Error 3052 - File Sharing Lock Count Exceeded....
1
by: Curtis Justus | last post by:
Hi, My back is against the wall and I've tried to figure out something to do. Here is my scenario: I have an automated process running in a service that generates HTML files. Each resulting...
6
by: Paul | last post by:
Not sure if this is the correct place to post the problem, but trying to use the HTML help workshop and trying to create the index file automatically. Anyhow I get the error below HHC5003: Error:...
4
by: Vlady | last post by:
Hello. I recently built an ASP.NET "financial" application. I got to the point where I have a HTML template (a contract) which needs to be filled with various data from the database. I put a...
1
by: Ryan Ginstrom | last post by:
I have been maintaining a body of documentation in plain HTML files. I would now like to automate the generation of the HTML files. Maintaining the HTML files now is tedious and error prone,...
6
by: PenguinPig | last post by:
Dear All Experts I would like to know how to convert a HTML into Image using C#. Or allow me contains HTML code (parsed) in Image? I also tried this way but it just display the character "<" &...
3
by: computer_guy | last post by:
Hi Everyone, I run into a problem. I am trying to write an aspx that can dynamically generate an image based on some input parameters. Things are very simple if the size of the parameters is...
15
by: lxyone | last post by:
Using a flat file containing table names, fields, values whats the best way of creating html pages? I want control over the html pages ie 1. layout 2. what data to show 3. what controls to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: 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
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
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...

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.