Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    PHP




Formatting Of A .txt File Output From A Web Form.


how I can force new lines to happen in a .txt file that stores the results of a webform that a user inputs? As it stands I've tried using and /n tags but they just print to the file and all the text runs on. Also, every time data is appended to the .txt file it appears on the same line.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Storing Form Output In XML File.
I have a form. I want two actions in it.

first

i want to save all the informations entered in form into a XML file.

second

How to save Mysql query output to a XML file.

Please give me some example (with code).

Formatting System() Output
I made this call.........

For Loop And Formatting Its Output
the following snippet of code x text fields are generated. I can
include <brat the end to split them onto separate lines, but how do I
modify the code to have two text fields on each line?

for ($x = 1; $x <= $ansperquest; $x++){
echo "Type Answer ".$x ?><input name="<?php echo 'ansE'.$x; ?>" size="30"
type="text"><?php
}

PHP Formatting DB Output In Loop?
I am trying to achieve the layout in the below image. I kinda have it correct but not really! Seems to be messing up a bit more than I expected. Bascially I am looking to format the box's with the text inside and the 10px padding between then like below. Code:

Problems With Formatting Query Output
I want my MySQL-output nicly formatted in an html table. But the code get distorted, I just cant see whats wrong. Anyone with better googles? The code:

Formatting Mysql Output As Content
i'm working on a web project that involves entire text articles that are stored in a mysql database to be presented as content on a website. certain parts of the text are going to be formatted differently than others (titles, links, email addresses) and i was wondering how other developers organize a project like this.

do you attempt to sort your data into meaningful columns in mysql such as title, author, etc and apply certain formatting options depending on the column it came from, or do you simply lump the entire article into a big blob and sort out the formatting with PHP?

i will be working with multiple articles that will all require the same formatting applied.

Formatting Output Of `ls -l` Shell Command
As in the topic, I use www to execute shell command, in this case 'ls -l' and i get output like:

total 8
drwx------ 11 lecichy staff 4096 Oct 15 18:18 Maildir
drwx---r-x 3 lecichy staff 4096 Oct 13 19:28 public_html

etc.
but what If i would want to print to www only some columns. e.g. only
filename and size like;

dir contains
Maildir size: 4096
public_html size 4096

or any other combinations, the point is if anyone has any ideas how to split the output of this command to variables on which i can easily operate?

And maybe its possible to achieve it in the other way. What I mean is
selecting filenames and so on as a regular strings from a specific line of
text?

Mysql Output Text Formatting
I have stored data into mySQL through a multiple lines textarea input. When I try to print it out using the echo() function it doesn't print multiple lines, so everything is on one line. How can I fix this?

PHP4/MySQL Formatting Result Set Output
I am currently coding a Photo Gallery project in PHP 4 and using MySQL to store information about the uploaded photos. My problem is that I am trying to get the images to be displayed in multiple columns accross the page, say 4-5 columns of small thumbnail images instead of all in one column as I have at present.

Formatting Form Input
I have a simple lweblog that I made for a website using php and mysql but I noticed that what I enter in the form is not what gets outputted. I want to have returns and spaces and and things like that. Does anyone know where a good place to learn how to do something like this? Or maybe tell me what to put in my code?

Formatting Form Data
I have a problem understanding how I can submit form data to a mysql database and preserve the formatting that the user wants. Essentially the problem is line breaks. When a user inserts data into a text area the text automatically jumps to the next line when the one line fills up with text.

Yet when the data is submitted to mysql it doesn't preserve the breaks. I've tried several solutions like the <pre> tag. Basically I want the break that the html textarea creates automatically when it reaches the end of the text area to generate a <br /> tag in my data submission.

Formatting Form Entry Into HTML
I was wondering how to go about allowing the information submitted into a form for something like a news service with a Mysql backend to have the ability to be formatted by the user for HTML attributes such as bolding text etc.

This question came about because I set up a press release and news section and have noticed that a number of users have asked if there was any way to make list items in their posts, and I wasn't sure what was needed to allow that type of functionality. Does it mean I have to start getting into WYSIWYG editors and the likes, or are their easier ways of doing it?

Formatting Email In HTML From PHP Form
I have a multi-page form called Dodosmail running our online
questionairre. Its written in PHP and works great. I just want to know
if there's a snippet out there that anyone knows about that can format
the results from the form into an HTML formatted email. There are so
many fields that it is hard to read the data if they arent put in
columns or tables. Any help would be appreciated. Im not a programmer
and hope I am in another life!

Php Generated Form Array And Formatting For Mysql Query
As part of a form I have created I have a MySQL generated table who's fields include soccer team names, opponents, next match date, matchid etc. . Each row has a check box with the value of the checkbox being the unique row ID in the MySQL table (match id). When a user selects the teams from the list he would like more information about, the checkbox variable is parsed to the script as an array "$var[]".

If I use the following code, I can see all the contents of the $Var array that has been parsed to the script.

[php
<?
$number=count($var);
for($a=0;$a<=$number;$a++){
echo $var[$a];
}
?> /php]

The problem is how do I format the above output so that I can include it in a MySQL query statement? I have no way of knowing how many teams have been selected or the key index number for each variable in the array. How do I code this so that each row matchid is assigned it's own unique varable such as team 1, team2 etc?

I was thinking of using a loop to go through the array and generate $var appended with a number using the the PHP count() function. but seeing that I am fairly new to PHP I'm not sure if this will work or where to start!

Formatting The Contents Of A Text Area Form Field
On my site I get users to enter a load of information in a textarea
box, however when i save this data to my mysql DB and then retrieve it,
it comes out without all the formatting, like new paragraphs and new
lines.

Can anyone tell me how you can capture the data entered into such a
field with all the formatting the user has entered like new paragraphs
etc?

Formatting From TXT File
I am using a txt file to store site URL's and names here is the code I am using:
PHP Code:

How Can I Use Css/xml Inside My Php File For Formatting
What I'd like to do is use xml in my php file for use with my css.  I noticed php can read from xml files to get data but can I use xml in my php file like how xhtml uses xml.  As in can I use xml with css for presentation  rather than as data entry. If you know what I mean.

Using PHP To Output A Form
I have a login system that gives registered users unique userIDs and stores their registration info in a MySQL DB. Now the tricky part:

I need a PHP that outputs a simple HTML form with a list of all the members (and their name and email) in the DB, with a checkbox next to each. This form must be specific to whomever is logged on, such that the data (s)he enters only goes into the relevant row, column or table of the individual whose checkbox was checked.

Summing up: I need a way for
(1) a form to display all the listed members in a MySQL DB and
(2) to have the info selected in the form entered into the relevant row, table, or column of the individual selected.

Modifying Form Output
I'm using FormMail for the first time. It seems to be working OK, but the email form notification ends with the line "Submit: submit" - obviously taking this from the Submit button at the bottom of the form. How can I prevent this showing on the email? It’s so unnecessary and unprofessional-looking. I can't believe it's intentional, so assume I’ve set something up incorrectly.

Saving The Output Of A Form To XML
I have some clients who want to do a bit of the maintenance of their homepages themselves and I would appreciate this because that will save me a lot of work.

Is it possible to generate the output of a form into XML instead of generating it into a database or into an e-mail? I have already got a PHP script which converts the XML into HTML.

Output Variable Contents In Htm File From Php File
I have a PHP file. No MYSQL database. I'd like to have it open an .htm file and output the results in the php file to the .htm template. So, for example say there is a bunch of variables called:

$make
$model
$year

I want to open a .htm file and output the contents of $make, $model & $year in the htm format using variables in the htm itself. ie. {make} {model} {year} and it would import the contents of each into the corresponding tag.

Make Output Of File A Variable In A Different File
Can someone tell me how to take the output of a very complex file, and make it a variable in a totally separate file?

Getting A File Via Http Or Evaluating A Php File And Getting Its Output
I need to somehow merge two separate web programs written in php
together (from the user's perspective). This solution won't be
perminant, I just need something done quickly. I was thinking of two
different approches.

One would be to download a processed version (modified so it will
create validating html with the page it's being embeded in) of one of
the programs with the other, then just use print to embed it in the
page. I couldn't find out how to get a file via http here
(http://us2.php.net/manual/en/index.php). Sorry if I missed this in
the docs.

The other would be to process the other program and get it's command
line output, and print that.

If there's a better way to this, I'd be glad to hear it :)

Also, I've never written any php before; so sorry if I missed
something obvious to someone who has.

Output Results In Link Form
I have script that includes a query that should output a link. The link is actually an image. So from the table it will get "image.jpg" while i will be providing the full href for it so that i becomes a link. My question is how do i use PHP (or PHP with JS to open up the image according to the image's size. Thus i dont need to define a fixed size always. PHP Code:

Form Field Text Output
How can I get html code in an editable form field to display properly? Specifically: I have text that is echoed to a form field via <? echo $text ?>

The user can then edit that text and submit. However <BR> is showing up as a literal <BR> and should be a linefeed. Is there a way to have this display properly?

Example: LINE ONE<BR>LINE TWO
should display as
LINE ONE
LINE TWO

Note that this is only a problem in the form field. It displays properly when echoed outside of the form.

Wrapping HTML Form Output.
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 shopping cart. This C program stores order
information, and when an order is processed and approved, records the
transaction and sends a template email to the customer with an invoice
describing their purchase. Since we're going to be selling a new
software product soon, they've asked me to write a script into the
website that will include License Keys to the product the customer has
purchased along with all other data about the order. The C program
DOES have functionality for custom variables, but it they've all got to
be neatly packaged and set up for the C code BEFORE the customer
completes the order, and I don't want these values to be evident at
that point, because a simple right click and View Source would expose
the keys to a non-purchasing client.

(I'm also going to mention in code a php file I'll call keyGen.php,
which will have one method called gen that will read a string, (which
I'll give from a cookie) and generate a key. I realize that reading a
cookie ain't a good way to do this, but I want to solve this problem
first then I'll find a way around the cookie problem).

So, what I'm thinking of doing is redirecting the Checkout button's
form, which previously pointed to the C CGI script, to point to a PHP
file, which I'll call Intercept.php, This php file will examine all the
form's inputs, repackage them, then use putenv and passthru to call the
C CGI with all the original form's variables as well as any new ones I
want to create. So essentially the code WAS

<html>
<form name=checkout method="post" action="/cgi-bin/shopper">
<input name="blah1">
<input name="blah2">
</form></html>

and now I need

<html>
<form name=checkout method="post" action="intercept.php">
<input name="blah1">
<input name="blah2">
</form></html>

and intercept.php as something like

<?php
include "keyGen.php";
$keyVal = gen($_COOKIE['basket']);
$keyName = "PASSLicKey";
$toInclude = "http://www.notawebsite.com/cgi-bin/shopper";
$toArgue = $keyName."+".$keyVal;

Input And Output In Same Form With Edit Facility
i am using MYSQL with php. the databse is containing the deatils of the stock of each supplier. i want to update the stock so i will enter the name of the dealer.i should be shown the existing stock and from ther only i should be able to edit the stock to update database.

Howto Output Html Taken From Textarea Form
if you want to send an html mail using phpmailer i find it doesnt work to let the user input html in a textarea form.

<form action="test2.php" method="post" enctype="multipart/form-data">
<textarea name="text" cols="60" rows="2"
wrap="VIRTUAL"></textarea>
<input name="submit" type="submit">
</form>

<?php echo "$text";?>

take this as an example. if i input <img src="jens"> i get as output <img src="jens"> which destroys my html emails. thank you very much for help as it is driving me mad.

#2: Creating 'output' With Form-collected Variables
Some dumb questions may follow...

I am learning PHP for a simple specialized calculator/curve-fitter
that collects input from a user then fits the data to their range of
conditions in the form of a table (actually just two columns of
output).

I bought a copy of Dmitri Koterov's book with a title something like
"Create your Web Page with PHP'. What I like about it is it explains
the how and why significantly instead of just examples.
I may eventually find an answer in there, but I'd like to supplement
reading with questions...

It APPEARS to me that my task will be even easier with PHP than
previous efforts with JavaScript.

It looks like I can simply ECHO the processed data embedded in tags,
like a <LIlist or even a <TABLE. With JS I got lost trying to
figure out other examples people referred me to with get inner html &
item ID etc...got too abstract for me.

It doesn't need to be fancy...thus far, I think the echo method may be
adequate.

So, at last, the question...I previously had trouble with JS figuring
out how to make variables accessible to more than one script (make
them 'global'?).

I think PHP is more flexible with variables...whether or not it is a
good practice, they apparently do not need to be explicitly defined by
type (they are interpreted by content?), but are they automatically
assumed to be global?

What do I need to do to them to make them be 'global' or "remembered"
for use by more than one script? What then would be their
'lifetime'...cleared when the script is exit-ed, or until refreshed by
a new form Submit? (Maybe what I'm hinting at is whether or not there
is the concept of a 'session' that gets reset somehow.

Lastly, can Submits of form data for the purpose of recalculation be
'processed' by other means than pressing a Submit button, like a
MouseOver or MouseOff kind of thing?

Write PHP Output Back To Form Textbox
I have a web form composing of textboxs for users to enter numbers into. After they press submit, I have a php script that processes the numbers and now echos back the output onto the page. I would like the php output to "echo" into a textbox of the form. How can I do this?

Creating A Form That Once Submitted Displays A Tabled Output
I have a form that I am trying to create that ideally will present a desired output based on the selections of the form.

The following is an example of the dataset I am pulling from:

I am trying to:

1. Have a drop-down selectable to select a start date.

2. Have another drop-down selectable to select a stop date.

3. Have radio buttons to select which datas I wish to view for the range set by steps 1 and 2. Example is nodes_available, nodes busy, one, both, or all.

4. Have the ability to select the interval of minute, hour, or day.

Once the form variables are selected, then it is submitted with the desired results displayed in a table on another page. Ideally this output will eventually find its output displayed in some type of graph form, but at the moment I am trying to atleast achieve the desired outcome.

How To Output A File As An Image File?
I wrote a web counter in php that displays text and images. What I am now trying to do is to convert the output of this php script in an image. Why? Because certain blogs like MSN Spaces do not accept that you embed scripts.

I believe I should look into the imagecreatefrom functions for a solution, but I find very little examples of how to use it, expecially imagecreatefromgd2 and the likes. Ideally I would need a function that allows me to input a URL (like my php script) and that ouputs an image.

Perhpas someone can help me with this?

Can I Use PHP To Output A XML File?
I have made a flash file that parses an XML file to get its content. I've tested it with a static XML and it works great. Let's call that XML "xml1".
I have made a MYSQL db and the accompanying PHP files to dynamically add information to the database. This works great.

I tried to use PHP to output an XML file to replace the static one, thus completing the circle and allowing the client to enter data into the db and see it in flash. Let's call this one "xml2".

The flash file won't accept the data from "xml2". I assume it's in some sort of doctype issue. By the way, I thought it might be the fact that the extension of "xml2" is .php instead of .xml, but that doesn't matter. "xml1" was successfully tested with a .php extension.

When I view "xml2" in a browser, it looks like it's being treated like html instead of XML, but when I view the source, it looks exactly like the code from "xml1". What is the difference? Code:

Popen() Output To A File?
I have a linux binary that I run from a webpage which produces a lot of output and I would like to send that to a file, but nothing seems to work here is an example.. It does however send it all to the httpd "error_log" file

Code:
<?
popen("/home/mybinaryfile > output.file", "w");
?>

Print Output From Log File
I my php script I call a perl script that perl script will create a log file

From the php script I want to read the log file and write the
output to the browser. This operation has to carried out for
till the perl script completes the process. This can be identifed
by [Process Completed] in the log file.

My problem is when I read the first line and print to the browser it
was going fine. Second time when the loop continues it print the sample
content again and again. This has to be avoided and it has the print the
new logs only. Or clear the previous output and print it fresh again.

Ex.

First time

Processing 1...

Second time

Processing 1...
Processing 1...
Processing 2...

Actually in the second time it should print only

Processing 1...
Processing 2...

My Code:
--------

while ($line = fgets($fp))
{
trim($line);
if ($line != "Completed")
{
print $line ."<BR>";
}
else
{
exit();
}
}
fclose($fp);

Sending Output To A File
Lets say I got something simple like:

<?php

echo "yo";
echo "word";

?>

I want all those echos to write to a file instead of printing to the screen
without changing to a different function. Sort of like how in Unix you can
do ./my_prog < file1 to output to a file. In this case I want it all to be
done in code. For example, something like:

<?php

output_to_file_instead_of_screen();

echo "yo";
echo "word";

output_to_screen();

?>

How To Output From File Into Table?
I have this bit of code that opens a file, reads it line by line, and
prints the filename into an image on screen, so i get a big list of
images on the page.

However I want it to output into a table so I can have 2 photos side by
side as it goes through, is there any way of manipulating the code to
output one line into one cell and the next line into the next cell then
back to the first cell again???

<?
$data = file('gallery/captions');

foreach ($data as $line)
{
list ($q, $a) = explode('|' , trim($line) );
echo "<img src='gallery/images/$q' height=100><br>";
echo "$a<br>";
}

?>

Running Script Before Output To File
I've got an HTML emailer system where the user creates an HTML file with their input from a form. I've had no problem with this part, neither with the email sending and display HTML. However, before the contents of the HTML email (the HTML file the user creates) gets applied as the message body and emailed via PHP, I would like the file to be passed through PHP and any scripts run that happen to be on the template. My actual portion of email code is here (where the file is read into a variable and the mail is sent):

$emailHeaders = "From: info@domain.com" .
"X-Mailer: PHP/" . phpversion() . "" .
"MIME-Version: 1.0" .
"Content-Type: text/html; charset=utf-8" .
"Content-Transfer-Encoding: 8bit";
$emailMessage = file_get_contents(path/filetosend.php);
$emailSubject = "Email Subject";
$emailRecipient = recipient@domain.com;
mail($emailRecipient, $emailSubject, $emailMessage, $emailHeaders);

How do I make any PHP scripts that are in the "filetosend.php" run before the output is stored into $emailMessage and mailed off?

Including File And Output To Browser
I am not sure I understand the rules as to what exactly gets output to a
browser and when. If I include a text only file or an html file, these will
show up in the browser regardless of where in the script they are included.

When Output File Shows Only Text...
In an attempt to try out some things with php, I have run into a new snag.
The output file is pure text. Basically it's a simple photo gallery using <ul> links to show various thumbnails. In turn, the thumbnails show a bigger image.
All on the same page. My only possible thinking is that it has something to do with the array notation.

$image =array ( );
$image[101]="name.jpg";
Is it correct to say $image = array(999);?
As to define 999 items? as in javascript?

Saving Output As An .html File
I have a script which takes about 20 or so fields as input and creates a big table out of all those. I want to log what happens and I was wondering if there's some way I can save each table as an .html file in my directory.

Output Xml File From Mysql Record
how to get the record from databse directly..but now my application require me to output my record as xml output....so I really need help on it.../some guide ...this is what's my xml gonna be.. Code:

Write Broswer Output To New File
I have a file (say, output.php) which produces information which is output to a browser at present. That's good. But I need the exact browser ouptut to be turned into a text file (say, output.txt) which will be automatically saved somewhere on my disk, whenever output.php is run. How can I make this happen?

Writing PHP Output To A Seperate File
I'm wondering how can I write the output of a PHP file into a seperate file, kinda like a 'snapshot' of that output.

Is There A Way.... To Output Information/text As A Graphic File.
What I mean is can I write my output of lets say a DB query and save as a .jpg or .png formatted file?

I seriously have no idea and have never seen anything along this line of questioning.

How To Write PHP Standard Output On A Text File?
Using PHP 4.3.11, I want my script not to write standard output on the
webpage, but
on a textfile.

I tried with:

Code: ( text )

Copy Large XML Output To A Local File
I have a URL that when called generate a very heavy XML Feed like:

www.domain.com/generateXML.php?id=products

when i call this URL in the browser i can see a very long XML file generated containing different information..i want to copy this all output to a local file on my server so that i can use that file's info for different tasks on my site...PHP Code:

How To Make Php-output Into .ppt Format (Powerpoint-file)
How can I use php and mysql to create a downloadable .ppt file from
the php-made output?

Dynamic XML + XSLT With Output As A Downloadable CSV File.
I Have a piece of dynamically generated XML, that i need to transform into a downloadable CSV file. There are several restrictions though. First of all i don't want to store output file on the server, and i don't have the XML file (it is being generated, but i do have the XSL file to transform the XML into CSV on my server). Any ideas on how i might do that?


Copyright © 2005-08 www.BigResource.com, All rights reserved