Jump to content

Welcome to Geeks to Go - Register now for FREE

Need help with your computer or device? Want to learn new tech skills? You're in the right place!
Geeks to Go is a friendly community of tech experts who can solve any problem you have. Just create a free account and post your question. Our volunteers will reply quickly and guide you through the steps. Don't let tech troubles stop you. Join Geeks to Go now and get the support you need!

How it Works Create Account
Photo

Guestbook building!?!


  • Please log in to reply

#1
ArNoLd

ArNoLd

    Member

  • Member
  • PipPip
  • 25 posts
hi ive just been searching the internet for a tutorial on building a guestbook of my own. i have done what the site says in that i have my form i want people to fill in. i have the page where i want it to be posted to. they are sorted.

in the form page i have the code

<body><form action="STUCK HERE!!" method="post">

what do i put in the stuck here bit? i know its a location of a file but what file??

is it the gbt file i was told to make by the tutorial?


i did try that but then it just took me to that file and displayed the html code :S :S im confused as to how i get it to post into my page.

mike.
  • 0

Advertisements


#2
ditto

ditto

    - i pwn n00bs -

  • Member
  • PipPipPipPip
  • 1,260 posts
what tutorial were you looking at. The action attribute is the location to where the page sends the variables to be carried out by the appropriate action.
  • 0

#3
sunny441

sunny441

    Member

  • Member
  • PipPipPip
  • 258 posts
Hey Arnold

You will have to Use PHP to make that Form active. If u have a button in that form called submit - you will have to link that button to the PHP file when you click submit - in short -" <form action ="filename .php">

PHP is the best way to get a form going and yu can make your own by using this program called InPhormer - which is available for free. Please note that this is an older version of the software and you will have to make changes manually to the code.

Cheers
  • 0

#4
ArNoLd

ArNoLd

    Member

  • Topic Starter
  • Member
  • PipPip
  • 25 posts
ok i downloaded inphormer, i kinda didnt know what to do in it so i just clicked sum stuff then when i put it as the action in my html code it opened to aa page which contained this....


<?
// +----------------------------------------------------------------------+
// | inPHormer form parse |
// | Built with inPHormer 1.03 |
// +----------------------------------------------------------------------+
// | Copyright © 2002 Shift srl |
// | http://www.shift.it |
// +----------------------------------------------------------------------+
$inPHormer_msg = "name: $name\nemail: $email\nlocation: $location\ncomments: $comments\n";
$inPHormer_err = "";
$inPHormer_ok = "";
$inPHormer_subj = "Info from your Site";
$inPHormer_mailTo = "";
$inPHormer_headSend = "From: inPHormer<$email>\n";
$inPHormer_headSend .= "Reply-To: $email\n\n";
if (!$name || !$comments) {
header("Location: $inPHormer_err");
exit;
} else {
if (ereg("^([0-9,a-z,A-Z]+)([.,_,-]([0-9,a-z,A-Z,]+))*([_,-])?[@]([0-9,a-z,A-Z]{3,})([_\,-]([0-9,a-z,A-Z]+))*[.]([0-9,a-z,A-Z]){2,3}([.]([0-9,a-z,A-Z]){2,3})?$", $email)){
$a = fopen("Guestboook", "a+");
fputs($a, "$name;$email;$location;$comments\n");
fclose($a);
header("Location: $inPHormer_ok");
} else {
header("Location: $inPHormer_err");
exit;
}
}
?>
  • 0

#5
sunny441

sunny441

    Member

  • Member
  • PipPipPip
  • 258 posts
Arnold:

Good job there getting the PHP program and the code. All you have to do is make sure you name your fields in the HTML file properly and make sure you know which is which. You then use InPHormer and build the PHP file - by simply pointing to the HTML file.

InPHormer has not been updated in the last few years - apparently some issue. I have made a list of a few things that you would have to do in order to get the PHP working.

Please make sure the submit button on your HTML file points to the PHP file!!!!! else all your efforts will come to nought!!!!!

$inPHormer_err = "error.html"; - this points to an page called error.html - where in the user has not filled in a form field or somethign of the sort - you can name the HTML file anything as long as you point it to the right file here.
$inPHormer_ok = "ok.html"; - another page that gives the user a notification that information has been rcvd and a response is on its way. and you can use the "meta redirect" tag to send them to another page from here!!!

$inPHormer_mailTo="emailaddress"; - enter your e-mail address here to get the data being entered to go the email you want.

Thats the easy part - now is the tricky part where you will have to enter a lot of Info due to the outdated nature of InPhormer.

right where you see the first line of the code in PHP,the $inPhormer_msg="blah blah blah" line,ABOVE THAT LINE you will have to enter a line for each of the form fields in your HTML file and each line will look like this
$fieldname = $HTTP_POST_VARS['fieldname ']; - please do make sure you get the field names right and you don't forget that HTTP_POST_VARS should be in uppercase. So for each field that is in the HTML file you will have a line that looks like the one posted there.

Thats pretty much about it!!! Hope this has been helpful !! please do let us know how it works and if you do need more info please do feel free to ask anyone around here

Cheers :tazz:
  • 0

#6
cobhcf

cobhcf

    Member

  • Member
  • PipPip
  • 81 posts
http://www.netspade....p/form-mail.xml
I hope this helps you to get to know whatz really happening behind the scenes... :tazz:
Cheers!
  • 0

#7
ArNoLd

ArNoLd

    Member

  • Topic Starter
  • Member
  • PipPip
  • 25 posts
rie ok sunny ill try what you said but is that for an email form like the link cob just gave us? my guestbook is to be posted on a webpage not into my email. this is what im sort of looking for except in my own design. (and no rubbish music)

http://www.bravenet....rvice=guestbook

cheers for the help
  • 0

#8
sunny441

sunny441

    Member

  • Member
  • PipPipPip
  • 258 posts
Yes - it will be a web based form, pretty much like what you are looking to build. You can customize the fields that yu want to have the user to fill out .

When i mentioned e-mail - i was simply saying that when the user clicks the submit button you can send the information to any email address of your choice!

Here is an example i found on someones personal page while surfing. It will look pretty much like that

http://www.andrews.e...h/guestbook.htm
  • 0

#9
cobhcf

cobhcf

    Member

  • Member
  • PipPip
  • 81 posts
ok i get what you are looking for. Arnold, you have got three best options.
1) Either you can get the values entered by the user and put it into an array.
2) get the values and put it into a Mysql database
3) get the values and put it into a file.
Then you can retreive the values whenever you need and put it on the page. I would go with the database option because it is secure and you can filter the data as u want it.
Go through these tutorials for a basic idea
PHP ARRAYS: http://www.developer...icle.php/977371 :)
Database handling with PHP: http://www.php-mysql-tutorial.com/ ;)
File handling in PHP: http://juicystudio.c...al/php/file.asp ;)

Or if you are ready for some cheats, here's the guestbook code:
http://www.php-mysql...6ac5c98330e1d96 :)

Cheers! :tazz:
  • 0

#10
sunny441

sunny441

    Member

  • Member
  • PipPipPip
  • 258 posts
Oh!!
now i get what yu were saying!! Hope those links help
  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP