We'd like to remind Forumites to please avoid political debate on the Forum... Read More »
📨 Have you signed up to the Forum's new Email Digest yet? Get a selection of trending threads sent straight to your inbox daily, weekly or monthly!
Need to create html based on user input...help
Options

LewisLover
Posts: 9 Forumite
in Techie Stuff
I'm trying to get a form to generate html source code based on values that are inputted..so..
Here is a basic form, with 2 fields.
field1: TEXT1
field2: TEXT2
This should output, for example:
...
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15">
<title>TEXT1</title>
<body>
TEXT2
</body>
....
Obviously the code would be something like
...
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15">
<title>*field1*</title>
<body>
*field2*
</body>
...
I’ve tried in javascript, and it works with normal text, but once you start using html it messes up. I thought about just using excel, but too time consuming. This is just for me to use, so i could possibly use php and run it locally..but not sure where to start.
Any other ideas??
Thanks!
Here is a basic form, with 2 fields.
field1: TEXT1
field2: TEXT2
This should output, for example:
...
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15">
<title>TEXT1</title>
<body>
TEXT2
</body>
....
Obviously the code would be something like
...
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15">
<title>*field1*</title>
<body>
*field2*
</body>
...
I’ve tried in javascript, and it works with normal text, but once you start using html it messes up. I thought about just using excel, but too time consuming. This is just for me to use, so i could possibly use php and run it locally..but not sure where to start.
Any other ideas??
Thanks!
0
Comments
-
what are you trying to achieve? typing html into a form to output into a html page seems like you are making extra work by making the form!
php would probably be the way to go though. if you are running it locally then you can download wamp which will give you a locally running web server with php and sql.
if you are just trying to avoid typing in the header information then in php you can use the includes statement which will pre fill the file with information from another so you can have the header in one file and call it everytime with - includes "/location/filename"
If I can help more let me knowLooking to set up a website. Use PM for the best prices.0 -
LewisLover wrote: »I'm trying to get a form to generate html source code based on values that are inputted..so..
I’ve tried in javascript, and it works with normal text, but once you start using html it messes up.
You probably need to escape the characters. Usually by putting backslashes in.
PHP is possibly the way to go though. The more interesting question is why?! :eek:
You could use a normal form, submit it and then create strings of text, appending $_POST into it.
edit: didn't see the previous poster, sorry.0 -
Thanks for the input.
Ok, basically i'm creating a daily newsletter which contains lots of links, text areas etc that need changing each day. I'm currenty using nVu (like dreamweaver) to edit the text and links one by one. Some URLs just need one parameter changing (fixed each day), some need the whole url replacing each time. So i thought it would be easier to have every possible thing that needs editing, into one big form, where i can just copy/type the info into, which would then output the full html. With nvu u often have to paste text into src code view only, or u lose any formatting, so it involves lots of clicking, and is pretty time consuming. I found this which is kind of what i want http://www.morphet.org.uk/comp/guava_ex1.html which lets you define x amount of values, and you can place these anywhere into the code as you wish...Hope that all makes sense!
I tried escaping all the characters, even things like > for > etc but still no luck.
I just tried to keep the example simple, so just picked the title and body as an example, sorry for the confusion!
Also, some text areas can only be a maximum of x characters before the layout is affected. Thats why i thought a form could be the best approach, which would also let me define the field sizes etc. Thinking i'm swaying towards PHP at the mo...0 -
Set the Form Action to output.php and method to POST
Then let output.php be
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15">
<title><?php echo $_POST; ?></title>
<body>
<?php echo $_POST; ?>
</body>0 -
Thanks Sam, i'll give that a go0
This discussion has been closed.
Confirm your email address to Create Threads and Reply

Categories
- All Categories
- 351K Banking & Borrowing
- 253.1K Reduce Debt & Boost Income
- 453.6K Spending & Discounts
- 244.1K Work, Benefits & Business
- 599K Mortgages, Homes & Bills
- 177K Life & Family
- 257.4K Travel & Transport
- 1.5M Hobbies & Leisure
- 16.1K Discuss & Feedback
- 37.6K Read-Only Boards