Noob question - form to html code

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Blaydo
Forum Newbie
Posts: 14
Joined: Fri Jun 06, 2003 4:31 pm
Location: Michigan, USA
Contact:

Noob question - form to html code

Post 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 :)
User avatar
redhair
Forum Contributor
Posts: 300
Joined: Fri May 30, 2003 4:36 pm
Location: 53.23N-6.57E
Contact:

Post 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!
Blaydo
Forum Newbie
Posts: 14
Joined: Fri Jun 06, 2003 4:31 pm
Location: Michigan, USA
Contact:

Post 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 :)
User avatar
redhair
Forum Contributor
Posts: 300
Joined: Fri May 30, 2003 4:36 pm
Location: 53.23N-6.57E
Contact:

Post by redhair »

You need a HTML edittor... ?
User avatar
redhair
Forum Contributor
Posts: 300
Joined: Fri May 30, 2003 4:36 pm
Location: 53.23N-6.57E
Contact:

Post 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>
Blaydo
Forum Newbie
Posts: 14
Joined: Fri Jun 06, 2003 4:31 pm
Location: Michigan, USA
Contact:

Post 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?
JPlush76
Forum Regular
Posts: 819
Joined: Thu Aug 01, 2002 5:42 pm
Location: Los Angeles, CA
Contact:

Post by JPlush76 »

8O
User avatar
redhair
Forum Contributor
Posts: 300
Joined: Fri May 30, 2003 4:36 pm
Location: 53.23N-6.57E
Contact:

Post by redhair »

Maybe you should try this article.
http://www.spoono.com/tutorials/php/flatfiles/
It tells you how to write files in php.
m3rajk
DevNet Resident
Posts: 1191
Joined: Mon Jun 02, 2003 3:37 pm

Post 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.
Last edited by m3rajk on Sat Jun 07, 2003 9:30 am, edited 1 time in total.
User avatar
redhair
Forum Contributor
Posts: 300
Joined: Fri May 30, 2003 4:36 pm
Location: 53.23N-6.57E
Contact:

Post 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....
Last edited by redhair on Sat Jun 07, 2003 12:18 pm, edited 1 time in total.
m3rajk
DevNet Resident
Posts: 1191
Joined: Mon Jun 02, 2003 3:37 pm

Post 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;}
?>
Last edited by m3rajk on Sat Jun 07, 2003 9:39 am, edited 2 times in total.
Blaydo
Forum Newbie
Posts: 14
Joined: Fri Jun 06, 2003 4:31 pm
Location: Michigan, USA
Contact:

Post 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.
Blaydo
Forum Newbie
Posts: 14
Joined: Fri Jun 06, 2003 4:31 pm
Location: Michigan, USA
Contact:

Post by Blaydo »

m3rajk: thanks :)
User avatar
redhair
Forum Contributor
Posts: 300
Joined: Fri May 30, 2003 4:36 pm
Location: 53.23N-6.57E
Contact:

Post 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.
Blaydo
Forum Newbie
Posts: 14
Joined: Fri Jun 06, 2003 4:31 pm
Location: Michigan, USA
Contact:

Post by Blaydo »

i already knew that by your first reply, no shock to me lol
Post Reply