Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   HTML (http://www.velocityreviews.com/forums/f31-html.html)
-   -   writing out data to a text file from a HTML form (http://www.velocityreviews.com/forums/t158993-writing-out-data-to-a-text-file-from-a-html-form.html)

Ron Smith 08-07-2004 10:47 PM

writing out data to a text file from a HTML form
 
What I want to do is create a HTML form that allows the user to enter data
into about 10 fields, and then based on the entered data, writes out data
strings to a text file. I am attempting to create a form for entering
simple rectangle CAD data via a HTML form, which will be written to a text
file, and then imported into a CAD program.

The form would contain prompt boxes for things like length, width, radius
size, step/repeat, etc. When the user hits the "SUBMIT" button, the data
strings would be written out to the filename the user specified. Below is
an example of data strings to be ouputted. Variables are &L, &W, &R,
&STEPX, &STEPY, &XN, &YN.

FRO 0 0 BY &L 0 ATT 1 POI 2
BY 0 &W ATT 1 POI 2
BY -&L,0 ATT 1 POI 2
TO 0 0 POI 2
JOI EXT 1 2 BLE &R
JOI EXT 2 3 BLE &R
JOI EXT 3 4 BLE &R
JOI EXT 4 1 BLE &R
TRY;SEC LAYOUT;REC;LAYOUT;YRT
SUB A POS 0 0 ATT 0;FILE A INT
MER A TO A
TRY;COP 1 BY &STEPX 0 TIM &XN-1;REC;YRT
TRY;COP .. BY 0 &STEPY TIM &YN-1;REC;YRT
--------------------------------------------------------

Any help on a source of example code would be appreciated.





Dave Patton 08-07-2004 11:02 PM

Re: writing out data to a text file from a HTML form
 
"Ron Smith" <rsmith@qwest.net> wrote in
news:2nl4gfF20lj5U1@uni-berlin.de:

> What I want to do is create a HTML form that allows the user to enter
> data into about 10 fields, and then based on the entered data, writes
> out data strings to a text file.


Make the target of the form be a PHP script that takes the
form inputs and writes the text file.

--
Dave Patton
Canadian Coordinator, Degree Confluence Project
http://www.confluence.org/
My website: http://members.shaw.ca/davepatton/

William Park 08-07-2004 11:52 PM

Re: writing out data to a text file from a HTML form
 
Ron Smith <rsmith@qwest.net> wrote:
> What I want to do is create a HTML form that allows the user to enter data
> into about 10 fields, and then based on the entered data, writes out data
> strings to a text file. I am attempting to create a form for entering
> simple rectangle CAD data via a HTML form, which will be written to a text
> file, and then imported into a CAD program.
>
> The form would contain prompt boxes for things like length, width, radius
> size, step/repeat, etc. When the user hits the "SUBMIT" button, the data
> strings would be written out to the filename the user specified. Below is
> an example of data strings to be ouputted. Variables are &L, &W, &R,
> &STEPX, &STEPY, &XN, &YN.
>
> FRO 0 0 BY &L 0 ATT 1 POI 2
> BY 0 &W ATT 1 POI 2
> BY -&L,0 ATT 1 POI 2
> TO 0 0 POI 2
> JOI EXT 1 2 BLE &R
> JOI EXT 2 3 BLE &R
> JOI EXT 3 4 BLE &R
> JOI EXT 4 1 BLE &R
> TRY;SEC LAYOUT;REC;LAYOUT;YRT
> SUB A POS 0 0 ATT 0;FILE A INT
> MER A TO A
> TRY;COP 1 BY &STEPX 0 TIM &XN-1;REC;YRT
> TRY;COP .. BY 0 &STEPY TIM &YN-1;REC;YRT
> --------------------------------------------------------
>
> Any help on a source of example code would be appreciated.


I don't understand. User types 'abc' into a form box, and you print it
out to a file. What is your question, exactly?

If this is question about how to print inside CGI, then take a look at
sample CGI script found on your machine or on Internet.

--
William Park <opengeometry@yahoo.ca>
Open Geometry Consulting, Toronto, Canada

Ron Smith 08-08-2004 12:38 AM

Re: writing out data to a text file from a HTML form
 

"William Park" <opengeometry@yahoo.ca> wrote in message
news:2nl89eF254g7U1@uni-berlin.de...
> Ron Smith <rsmith@qwest.net> wrote:
> > What I want to do is create a HTML form that allows the user to enter

data
> > into about 10 fields, and then based on the entered data, writes out

data
> > strings to a text file. I am attempting to create a form for entering
> > simple rectangle CAD data via a HTML form, which will be written to a

text
> > file, and then imported into a CAD program.
> >
> > The form would contain prompt boxes for things like length, width,

radius
> > size, step/repeat, etc. When the user hits the "SUBMIT" button, the

data
> > strings would be written out to the filename the user specified. Below

is
> > an example of data strings to be ouputted. Variables are &L, &W, &R,
> > &STEPX, &STEPY, &XN, &YN.
> >
> > FRO 0 0 BY &L 0 ATT 1 POI 2
> > BY 0 &W ATT 1 POI 2
> > BY -&L,0 ATT 1 POI 2
> > TO 0 0 POI 2
> > JOI EXT 1 2 BLE &R
> > JOI EXT 2 3 BLE &R
> > JOI EXT 3 4 BLE &R
> > JOI EXT 4 1 BLE &R
> > TRY;SEC LAYOUT;REC;LAYOUT;YRT
> > SUB A POS 0 0 ATT 0;FILE A INT
> > MER A TO A
> > TRY;COP 1 BY &STEPX 0 TIM &XN-1;REC;YRT
> > TRY;COP .. BY 0 &STEPY TIM &YN-1;REC;YRT
> > --------------------------------------------------------
> >
> > Any help on a source of example code would be appreciated.

>
> I don't understand. User types 'abc' into a form box, and you print it
> out to a file. What is your question, exactly?
>
> If this is question about how to print inside CGI, then take a look at
> sample CGI script found on your machine or on Internet.
>
> --
> William Park <opengeometry@yahoo.ca>
> Open Geometry Consulting, Toronto, Canada


Sorry for the confusion. User types in values (numbers) for length, width,
and radius size of a rectangle, how many they want, and the step/repeat
value of the rectangle matrix. The code (resulting text file) which you
highlighted is created from the data inputted by the user, and later, this
text file is imported into a CAD program.



Hywel 08-08-2004 07:13 AM

Re: writing out data to a text file from a HTML form
 
In article <2nl4gfF20lj5U1@uni-berlin.de>, Ron Smith says...
> What I want to do is create a HTML form that allows the user to enter data
> into about 10 fields, and then based on the entered data, writes out data
> strings to a text file. I am attempting to create a form for entering
> simple rectangle CAD data via a HTML form, which will be written to a text
> file, and then imported into a CAD program.


What server-side processing do you have? ASP? CGI? PHP?

--
Hywel

http://sponsorhywel.org.uk/

Toby Inkster 08-08-2004 10:16 AM

Re: writing out data to a text file from a HTML form
 
Ron Smith wrote:

> What I want to do is create a HTML form that allows the user to enter data
> into about 10 fields, and then based on the entered data, writes out data
> strings to a text file.


http://examples.tobyinkster.co.uk/cad/form
http://examples.tobyinkster.co.uk/cad/handler-src

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
Now Playing ~ ./no_doubt/dont_speak.ogg


Ron Smith 08-08-2004 12:02 PM

Re: writing out data to a text file from a HTML form
 

"Toby Inkster" <usenet200408@tobyinkster.co.uk> wrote in message
news:pan.2004.08.08.10.16.53.914085@tobyinkster.co .uk...
> Ron Smith wrote:
>
> > What I want to do is create a HTML form that allows the user to enter

data
> > into about 10 fields, and then based on the entered data, writes out

data
> > strings to a text file.

>
> http://examples.tobyinkster.co.uk/cad/form
> http://examples.tobyinkster.co.uk/cad/handler-src
>
> --
> Toby A Inkster BSc (Hons) ARCS
> Contact Me ~ http://tobyinkster.co.uk/contact
> Now Playing ~ ./no_doubt/dont_speak.ogg
>

Toby,

Thanks a lot. That is exactly what I was looking for.

Ron



Toby Inkster 08-08-2004 12:51 PM

Re: writing out data to a text file from a HTML form
 
Ron Smith wrote:
> Toby Inkster wrote:
>
>> http://examples.tobyinkster.co.uk/cad/form
>> http://examples.tobyinkster.co.uk/cad/handler-src

>
> Thanks a lot. That is exactly what I was looking for.


No worries.

I did forget to mention one particular gotcha though -- your web host has
to support server-side scripting in some language. (I used PHP in the
example, but doing the same thing in Perl, Python, JSP or ASP would be
smiple.) Nowadays most hosts do support some kind of server-side scripting
(except most free hosting packages).

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
Now Playing ~ ./warm_jets/future_signs/07_autopia.ogg


Ron Smith 08-08-2004 02:40 PM

Re: writing out data to a text file from a HTML form
 

"Toby Inkster" <usenet200408@tobyinkster.co.uk> wrote in message
news:pan.2004.08.08.12.51.35.921950@tobyinkster.co .uk...
> Ron Smith wrote:
> > Toby Inkster wrote:
> >
> >> http://examples.tobyinkster.co.uk/cad/form
> >> http://examples.tobyinkster.co.uk/cad/handler-src

> >
> > Thanks a lot. That is exactly what I was looking for.

>
> No worries.
>
> I did forget to mention one particular gotcha though -- your web host has
> to support server-side scripting in some language. (I used PHP in the
> example, but doing the same thing in Perl, Python, JSP or ASP would be
> smiple.) Nowadays most hosts do support some kind of server-side scripting
> (except most free hosting packages).
>
> --
> Toby A Inkster BSc (Hons) ARCS
> Contact Me ~ http://tobyinkster.co.uk/contact
> Now Playing ~ ./warm_jets/future_signs/07_autopia.ogg
>

I downloaded and installed an Apache webserver, with PHP. Being new to
both, I am having trouble figuring out how to associate the two files (HTML
form screen and PHP file), in regards to file location and filename. ie.
Where do I place them on my local server so Apache can find them? I
couldn't figure out how you did it, but I assume the hander-src file has a
..PHP extension.



Toby Inkster 08-08-2004 06:00 PM

Re: writing out data to a text file from a HTML form
 
Ron Smith wrote:
> Toby Inkster wrote:
>
>> http://examples.tobyinkster.co.uk/cad/form
>> http://examples.tobyinkster.co.uk/cad/handler-src
>>
>> I did forget to mention one particular gotcha though -- your web host has
>> to support server-side scripting in some language.

>
> I downloaded and installed an Apache webserver, with PHP.


You do realise that PHP needs to be installed on your web server, not on
your desktop computer? (Though for some people, like me, your desktop
computer *is* your web server!)

> Being new to both, I am having trouble figuring out how to associate the
> two files (HTML form screen and PHP file), in regards to file location
> and filename. ie. Where do I place them on my local server so Apache
> can find them? I couldn't figure out how you did it, but I assume the
> hander-src file has a .PHP extension.


This file <http://examples.tobyinkster.co.uk/cad/handler-src> is a red
herring -- the real engine is at
<http://examples.tobyinkster.co.uk/cad/handler> but you won't be able to
see it, because the actual PHP code that does the work never gets sent to
the browser. That's why I put a highlighted *copy* of the source code at
<http://examples.tobyinkster.co.uk/cad/handler-src>

The form's "action" attribute should point to the handler.php file. The
handler.php file should contain this code:

<?php
header("Content-Type: text/plain");

$L = $_GET['L'];
$W = $_GET['W'];
$R = $_GET['R'];
$STEPX = $_GET['STEPX'];
$STEPY = $_GET['STEPY'];
$XN = $_GET['XN'];
$YN = $_GET['YN'];
?>
FRO 0 0 BY <?= $L ?> 0 ATT 1 POI 2
BY 0 <?= $W ?> ATT 1 POI 2
BY -<?= $L ?>,0 ATT 1 POI 2
TO 0 0 POI 2
JOI EXT 1 2 BLE <?= $R ?>
JOI EXT 2 3 BLE <?= $R ?>
JOI EXT 3 4 BLE <?= $R ?>
JOI EXT 4 1 BLE <?= $R ?>
TRY;SEC LAYOUT;REC;LAYOUT;YRT
SUB A POS 0 0 ATT 0;FILE A INT
MER A TO A
TRY;COP 1 BY <?= $STEPX ?> 0 TIM <?= $XN ?>-1;REC;YRT
TRY;COP .. BY 0 <?= $STEPY ?> TIM <?= $YN ?>-1;REC;YRT

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
Now Playing ~ ./billy_joel/new_york_state_of_mind.ogg



All times are GMT. The time now is 09:33 PM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57