Jump to content
amitamberker

Basic Guest Book Code

Recommended Posts

Hi, --- [ Hi Deirdre's Dad ]Before proceeding further, I would like to thank "Deirdre's Dad" for helping me to understand about "<div></div>" and preparing me to Design a basic TableLess Website.Okay - Here I go... My .HTML code is:

<html><head><title>Testing</title><style type="text/css">body { margin: 0px; }div#container { margin: 0px auto 0px auto; width: 800px;}</style></head><body><div id="container"><div><form method="post" action=""> <table style="width: 100%" cellspacing="0" cellpadding="0"> <tr> <td align="left">Upon clicking the submit button, the visitor's entries should display here.</td> </tr> <tr> <td> </td> </tr> <tr> <td align="left"><label> <br /> Name: <input name="Text1" type="text" size="40" /><br /> <br /> Email: <input name="Text2" type="text" size="40" /><br /> <br /> Comments: <br /> <br /> <textarea name="comments" id="comments" cols="45" rows="5"></textarea> <br /> <br /> <input type="submit" name="Submit" id="Submit" value="Submit" /> </label></td> </tr> </table> </form></div></div></body></html>
Let’s proceed "One Thing" at a time and thus it would be easier for me to follow and understand you.

Share this post


Link to post
Share on other sites

maybe that was the "one thing" he wanted to start with?

Share this post


Link to post
Share on other sites

Hi Deirdre's Dad / Hi thescientist,When a Visotor fills his / her information and makes a comment, they would hit the Submit button. Upon clicking the submit button, how can I have / get visitor's entries on the same .html page?

Share this post


Link to post
Share on other sites

0) Learn a server-side scripting language.1) Create a database or an XML / plain text document to hold the comments.2) Create a server-side script to process the form data, and add it to the repository you created.3) Modify the page with the form, again using a server-side language, to read the repository and display the contents.

Edited by Synook

Share this post


Link to post
Share on other sites
0) Learn a server-side scripting language.
I tried to learn it. But alas, in-vain. I am here to seek guidance. I mean, I need the Codes and then I would like to know about HOW and WHERE and WHY to incorporate it. Check the "Html Code Versus Div Tag" posting in the "HTML/XHTML" and you would know how Deirdre's Dad helped me to understand about "<div></div>" tags. Okay?
1) Create a database or an XML / plain text document to hold the comments.
How do I do it?
2) Create a server-side script to process the form data, and add it to the repository you created.
How do I do it?
3) Modify the page with the form, again using a server-side language, to read the repository and display the contents.
How do I do it?

Share this post


Link to post
Share on other sites

OK, if you've looked a bit through the PHP tutorials, you should know a little bit about how to use it.What you first need to do is know how to work with data sent by forms. These chapters will help with that:http://w3schools.com/php/php_forms.asphttp://w3schools.com/php/php_get.asphttp://w3schools.com/php/php_post.aspThe basics of forms is that each <input> element in the form has a name attribute. On the server-side, that's how you'll identify the name of the variable:HTML:<input name="username" type="text">PHP:echo $_POST['username']Once you know how to work with form data, you'll need to know how to connect to a database:http://w3schools.com/php/php_mysql_intro.aspAdd the form data to the database:http://w3schools.com/php/php_mysql_insert.aspAnd retrieve the information from the database to display it later:http://w3schools.com/php/php_mysql_select.asp

Share this post


Link to post
Share on other sites

GREAT! So shall we work-out over here on this discussion / posting? Let’s proceed "One By One" and thus it would be easier for me [and others] to follow and understand you.

Share this post


Link to post
Share on other sites

Hi,Could someone help me to work-out over here as per "Ingolme's" feedback? Let’s proceed "One By One" OR "One Thing At A Time" and thus it would be easier for Me [and perhaps others] to follow and understand.Thanks!

Share this post


Link to post
Share on other sites

Nobody over here to discuss with me? hummm...

Share this post


Link to post
Share on other sites

what do you want to discuss? Ingolme showed a you a lot of stuff to read; did you read it? It would be more prudent to have something to show to let us know that you're working on something that we can help you with. It's your project, you know the details and the direction of where it's going (or needs to go). The ball is in your court.

Share this post


Link to post
Share on other sites

OK, let's organize your project.The key part of a guestbook is the database on the backend. So you first must go to your web host and create a database, and a database table. How must the table be structured? It's your decision.Here are a few database table structures you might want to use:

  • username, comment
  • username,date,comment
  • username,email,date,comment

Obviously, the more complex the database table is, the more work you'll have to do to put the information in the database and display it on the page.Do you know enough about databases? If you don't, you're going to have to read the PHP MySQL chapters. But if you don't know PHP yet, you really should look through the whole tutorial, because programming is not something you can learn in just a few steps, you need to work with it and get to understand it with time and practice.

Share this post


Link to post
Share on other sites

Hi Ingolme,Thanks a bunch for your response and organizing my project.

The key part of a guestbook is the database on the backend.
Okay - Gotch you.
So you first must go to your web host and create a database, and a database table.
Okay - I would like to explore it on this discussion / posting. So, do I need to get into my domain's Control Panel area?
How must the table be structured? It's your decision.
Okay - We can discuss about it when the Time and Day pops-up.
Obviously, the more complex the database table is, the more work you'll have to do to put the information in the database and display it on the page.
Really???... hummmm... Then I would like to proceed with JUST "Comment".Alrighty!!!... Here I go with my updated CODE:
<form method="What Should I Type / Insert Here?" action="What Should I Type / Insert Here?"><table style="width: 100%" cellspacing="0" cellpadding="0"><tr><td align="left">Guest Book Entries</td></tr><tr><td> </td></tr><tr><td align="left"><label>Comments: <br /><br /><textarea name="comments" id="comments" cols="45" rows="5"></textarea><br /><br /><input type="submit" name="Submit" id="Submit" value="Submit" /></label></td></tr></table></form>

Share this post


Link to post
Share on other sites
Okay - Then, here is my updated CODE:
<form method="POST" action="VISITORS.php"><table style="width: 100%" cellspacing="0" cellpadding="0"><tr><td align="left">Guest Book Entries</td></tr><tr><td> </td></tr><tr><td align="left"><label>Comments: <br /><br /><textarea name="comments" id="comments" cols="45" rows="5"></textarea><br /><br /><input type="submit" name="Submit" id="Submit" value="Submit" /></label></td></tr></table></form>
HUM!!!... So what should I incorporate in "VISITORS.php" file?

Share this post


Link to post
Share on other sites
Okay - Then, here is my updated CODE:HUM!!!... So what should I incorporate in "VISITORS.php" file?
ur visitor .php should be the script that will process the form.that means will handle the form and will do with it what so ever u wish to do with the for.okso u need to learn sever scripting first

Share this post


Link to post
Share on other sites
ur visitor .php should be the script that will process the form.that means will handle the form and will do with it what so ever u wish to do with the for.ok so u need to learn sever scripting first
Hi Panta,Thanks a lot for your response.So do I need to incorporate some kind of CODE in "visitors.php" file? If yes, what kind of code do I need to incorporate? I am feeling it very difficult to learn "sever scripting". I would be more than glad if you could help me to proceed further till we accomplish this task. Perhaps I can pay you from my PayPal Account if you want me too. I have been struggling to have a “Basic Guest Book Concept” from past 4 years. All my attempts are going IN-VAIN.FYI - There is a local guy over here. He said:* Technologies to be used:PHP, XML* Total estimated hours: 6But he is charging me too much of ransom and hence I am back on this Forum.

Share this post


Link to post
Share on other sites

Hey Panta, where are you???...

Share this post


Link to post
Share on other sites

Returning to one of my previous posts:

OK, if you've looked a bit through the PHP tutorials, you should know a little bit about how to use it.What you first need to do is know how to work with data sent by forms. These chapters will help with that:http://w3schools.com/php/php_forms.asphttp://w3schools.com/php/php_get.asphttp://w3schools.com/php/php_post.aspThe basics of forms is that each <input> element in the form has a name attribute. On the server-side, that's how you'll identify the name of the variable:HTML:<input name="username" type="text">PHP:echo $_POST['username']
You have to process the form data. You have to learn, try to understand what is going on. The W3Schools pages have the answers. If you took the time and dedication to read through the W3Schools PHP tutorial a few times you would find everything you need to know to make a guest book.This page in particular explains how to receive and work with form data:http://w3schools.com/php/php_post.aspDon't just copy the code, read the explanations. If you read the explanations correctly you should have understood what the "method" and "action" attributes are for from this page:http://w3schools.com/php/php_forms.asp

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...