Page 1 of 2

Noob question - form to html code

Posted: Fri Jun 06, 2003 4:31 pm
by Blaydo
Hey guys Its mike (blaydo) and I just joined the forums. I have a question for you guys.

Ok here's whats up, I have a client who needs to gather text and images from a form, and generate an html code for their yahoo store. The images will be uploaded and stored on our server, and the resizing will not be an issue. The content will need to be dropped into tables in our template, and everything needs to be in html at the end result.

If anyone has any ideas on how to do any of this, please reply. again, i'm a noob and i'm trying to learn the good ol code :)

Posted: Fri Jun 06, 2003 5:28 pm
by redhair
i could recommend reading this book: http://www.thickbook.com/books/index.html#phpfe , maybe someone else could teach you to learn the good ol code (im to busy)
It's a really good book that teaches you the basics of php. There is also a lot on the web to learn from.
Good luck!

Posted: Fri Jun 06, 2003 5:36 pm
by Blaydo
lol thanks :)

yea i have some books on order, they wont be here til july so thats why i ask.

i got the image uploader down pat, not a problem. the only thing i really need to know is how to drop the content into pre-defined tables, in html of course :)

Posted: Fri Jun 06, 2003 5:45 pm
by redhair
You need a HTML edittor... ?

Posted: Fri Jun 06, 2003 5:52 pm
by redhair

Code: Select all

<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title> New Document </title>
</head>

<body>
<!-- This is a pre-defined table -->
<table width='100%' border='0' cellpadding='0' cellspacing='0'>
 <tr>
  <td width='100%'>
  <!-- This is your image -->
  <img src='http://www.yourserver.com/imagepath/your_image.gif' alt='' height='200' width='400' border='0'></td>
 </tr>
</table>
</body>
</html>

Posted: Fri Jun 06, 2003 6:01 pm
by Blaydo
lol nah i use notepad...

i know how to code in HTML, thats not the thing. What i want to know how to do, is take information from a HTML form, and display the given text and image fields into a new HTML document's tables.

so its like HTML FORM INFO > php program > HTML CODE

i dont need a web page, all i need is the code at the end result, but a html page will do.

its kind of like a guest book, only i'll have 6 or 7 content areas that will request data from the form.

confused?

Posted: Fri Jun 06, 2003 6:17 pm
by JPlush76
8O

Posted: Fri Jun 06, 2003 6:42 pm
by redhair
Maybe you should try this article.
http://www.spoono.com/tutorials/php/flatfiles/
It tells you how to write files in php.

Posted: Fri Jun 06, 2003 7:06 pm
by m3rajk
Blaydo wrote:lol nah i use notepad...

i know how to code in HTML, thats not the thing. What i want to know how to do, is take information from a HTML form, and display the given text and image fields into a new HTML document's tables.

so its like HTML FORM INFO > php program > HTML CODE

i dont need a web page, all i need is the code at the end result, but a html page will do.

its kind of like a guest book, only i'll have 6 or 7 content areas that will request data from the form.

confused?
notepad? *cringe*

i did that when i first picked up html... back when it was at 2.0... then i learned of an operating system known as unix and soemthing known as GNU (http://www.gnu.org) and this great thing called emacs... it's an actual editor made from programmers. much better. it's got a variant called xemacs (http://www.xemacs.org/) that has a windows port. unlike notepad that has a 400 something character limit, this has no limit for the lines.

it also does "pretty printing", text highliting and parenthesis matching.

i'm going to go out on a limb and venture a guess that you haven't spent a lot of time in a normal programming environment.

i had one in college.... trust me, the parenthesis matching alone is worth getting xemacs, the others just make it pure torture to continue with notepad.


those three attributes imentioned are not the only reasons to get it. it will help you a lot as you get more into programmins. i STRONGLY suggest you get it. i do all my programming on a linux server, either remotely using ssh and emacs or directly using xmeacs.

Posted: Fri Jun 06, 2003 7:21 pm
by redhair
m3rajk wrote:i'm going to go out on a limb and venture a guess that you haven't spent a lot of time in a ormal programming environment.
This is pure poetry....

Posted: Fri Jun 06, 2003 7:25 pm
by m3rajk
now to try to help the php question (and hopefully let the older people hear realize if they go help me that it might benefit them since i might be able to discover something that'll help them later)

instead of using html, use php.


here's an example:

Code: Select all

<?php
/* set all declarations needed here*/

/* start a session so that the form is not submitted multiple times */

if (isset($somevariable)&&($somevariable=='something')){
  formprocessingfunction();
}else{
  printform();
}

function printform(){
echo <<<<END

/* type form here */

END;}

function formprocessingfunction(){
echo <<<<END

 /* type processed form here */

END;}
?>
note: each name in the form becomes a variable in php afterwods, but to make sure it's done right, i suggest using $_GET['name']; or $_POST['name']; to set the variables.

then use them in the second part, the processed form, so if the form is something like....

<form name="example" action="$SERVER[PHP_SELF]}" method="POST">
<input type="hidden" name="submitted" value="true">
<input type="text" name="name" size="20">
<input type="text" name="email" size="25">
<input type="submit"></form>

and the processing is something like ...

hey $name! thanks for coming! when we get more done we'll <a href="mailto:$email">mail you</a>

Code: Select all

<?php
/* set all declarations needed here*/

/* start a session so that the form is not submitted multiple times */

if (isset($somevariable)&&($somevariable=='something')){
  formprocessingfunction();
}else{
  printform();
}

function printform(){
echo <<<<END

<html><title>this is a test for you</title></head><body>
<form name="example" action="$SERVER[PHP_SELF]}" method="POST">
<input type="hidden" name="submitted" value="true">
<input type="text" name="name" size="20">
<input type="text" name="email" size="25">
<input type="submit"></form>
</body></html>

END;}

function formprocessingfunction(){
echo <<<<END

 /* type processed form here */

END;}
?>

Posted: Fri Jun 06, 2003 7:28 pm
by Blaydo
actually i have primal script but rarely use it since it is at my work, and i have taken 2 years in VB in highschool, so actually i do have some idea when it comes to programming, just not for the web.

the more and more research i'm doing i'm leaning towards doing it in perl instead of php, i just thought maybe someone who was nice would take the time to half way explain it, or give some example codes, instead of just easily post whoring me off to links and books, and pointing and laughing.

Posted: Fri Jun 06, 2003 7:29 pm
by Blaydo
m3rajk: thanks :)

Posted: Fri Jun 06, 2003 7:35 pm
by redhair
Pointing you to links... was far less work m3rajk putt in to it.. you should thank him...i don't have the patience or the time to help noobs the way he did.

Posted: Fri Jun 06, 2003 7:41 pm
by Blaydo
i already knew that by your first reply, no shock to me lol