Go Back   PCMech Forums > Help & Discussion > Web Design / Development

Need Some Help? Type Your Keywords Here:

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Old 08-06-2004, 06:00 AM   #1
Member (8 bit)
 
batiso's Avatar
 
Join Date: Jun 2003
Location: Malawi
Posts: 203
Question making a form on my website

I wanted to ask guys out there i am in kind of fix. I have developed a web page for my friend. He was browsing on a BBC site and found a form whereby you fill a form and click send then an email goes to BBC.
this is the site http://www.sdnp.org.mw/~manga/ pliz advise on where forward.
batiso is offline   Reply With Quote
Old 08-06-2004, 07:11 AM   #2
Member (9 bit)
 
MulderMan's Avatar
 
Join Date: Dec 2003
Location: England
Posts: 362
Send a message via AIM to MulderMan
is your server php enabled? and do you have any exp. in php?
MulderMan is offline   Reply With Quote
Old 08-06-2004, 08:47 AM   #3
Member (8 bit)
 
batiso's Avatar
 
Join Date: Jun 2003
Location: Malawi
Posts: 203
i dont have much exp am just starting out in that area. At the moment my friend told me that its simple and i can get it on the net.
About my server being PHP enabled i think it is coz a couple of websites which run on our server have these forms.
batiso is offline   Reply With Quote
Old 08-06-2004, 08:48 AM   #4
Moderator
Staff
Premium Member
 
Join Date: Aug 2003
Location: Richmond, VA
Posts: 7,835
PHP Code:
<form method="POST" action="mailto:INSERT EMAIL ADDRESS HERE"><textarea name="comment" ROWS=6 COLS=40>
</
TEXTAREA><input type="submit"></form
Hope that helps,
kram
__________________
"For today, goodbye. For tomorrow, good luck. And forever, Go Blue!"
University of Michigan President Mary Sue Coleman
kram 2.0 is offline   Reply With Quote
Old 08-06-2004, 09:20 AM   #5
Member (8 bit)
 
batiso's Avatar
 
Join Date: Jun 2003
Location: Malawi
Posts: 203
check out the page now but the problem comes when you try to send the mail. I can see the form alrite but i cant send to the addres specified.
batiso is offline   Reply With Quote
Old 08-06-2004, 09:31 AM   #6
Member (9 bit)
 
MulderMan's Avatar
 
Join Date: Dec 2003
Location: England
Posts: 362
Send a message via AIM to MulderMan
This is what i used to use on my site.

index.html
PHP Code:
<form method="get" action="contact.php">
Your Name:
<
input type="text" name="name">
Your E-mail Address:
<
input type="text" name="email">
Subject:
<
input type="text" name="subject">
Message:
<
textarea name="message" cols="40" rows="10"></textarea>

<
input type="submit" value="send">
</
form
then contact.php
PHP Code:
<?php
if($name) {
$name=$_GET['name'];
$email=$_GET['email'];
$subject1=$_GET['subject'];
$message=$_GET['message'];
$ip=$_SERVER["REMOTE_ADDR"];
$host gethostbyaddr($_SERVER['REMOTE_ADDR']);
$host $ip.".".$host;
$mon=date(m);
$day=date(j);
$year=date(y);
$hour=date(g);
$min=date(i);
$sec=date(s);
$hour=$hour-2;
if(
$hour<=0) { $hour+=12; }
$ts "$hour:$min:$sec on $mon/$day/$year";
//reciving email
$to="mail@mail.com";
//email subject
$subject="Subject:"." $subject1";
$body="
Message from: $name
Subject: $subject1
E-mail: $email
Message: $message

Host: $host
Time: $ts"
;

mail($to$subject$body);
echo 
"";
}
?>
you just need to edit what you want the title to be and you email address under where the comments are.
MulderMan is offline   Reply With Quote
Old 08-06-2004, 10:54 AM   #7
Staff
Premium Member
 
mairving's Avatar
 
Join Date: Jul 1999
Location: Arlington, TN
Posts: 5,538
Your mailto form on your site won't work because you used reset instead of submit. This resets the form. Mailto is a quick and dirty way to do it. Mulderman has given a little better one but you should have some validation of the fields as to whether they are filled in and whether the email address is valid.

Look over at Zend for some more complex scripts.
__________________

Want to Make $$$$ with your Computer? No Risk! Simply press shift-4 four times in a row
mairving is offline   Reply With Quote
Old 08-09-2004, 01:43 AM   #8
Member (8 bit)
 
batiso's Avatar
 
Join Date: Jun 2003
Location: Malawi
Posts: 203
Mulderman
do i need to edit the first part or the part which needs editing is the one below. And i dont understand how the second part fits. do i just add it below the code for the form.
batiso is offline   Reply With Quote
Old 08-09-2004, 06:53 AM   #9
Staff
Premium Member
 
mairving's Avatar
 
Join Date: Jul 1999
Location: Arlington, TN
Posts: 5,538
Quote:
Originally Posted by batiso
Mulderman
do i need to edit the first part or the part which needs editing is the one below. And i dont understand how the second part fits. do i just add it below the code for the form.
batiso, if you notice in the first part,
<form method="get" action="contact.php">
It says that the action is to call contact.php page upon submit. This means that you need two pages in this case and would edit the only the second page.

This could quite easily all have been done on one page as well but in this example it is 2.
mairving is offline   Reply With Quote
Old 08-10-2004, 02:23 AM   #10
Member (8 bit)
 
batiso's Avatar
 
Join Date: Jun 2003
Location: Malawi
Posts: 203
Marving thanks for the advice it really has helped me a lot. Check the site now and you will see your sweat the man
http://www.sdnp.org.mw/~manga/
batiso is offline   Reply With Quote
Old 08-10-2004, 06:41 AM   #11
Staff
Premium Member
 
mairving's Avatar
 
Join Date: Jul 1999
Location: Arlington, TN
Posts: 5,538
Quote:
Originally Posted by batiso
Marving thanks for the advice it really has helped me a lot. Check the site now and you will see your sweat the man
http://www.sdnp.org.mw/~manga/
No sweat for me. Glad that you got things going.
mairving is offline   Reply With Quote
Old 08-10-2004, 11:13 AM   #12
Member (9 bit)
 
MulderMan's Avatar
 
Join Date: Dec 2003
Location: England
Posts: 362
Send a message via AIM to MulderMan
Quote:
Originally Posted by mairving
Your mailto form on your site won't work because you used reset instead of submit. This resets the form. Mailto is a quick and dirty way to do it. Mulderman has given a little better one but you should have some validation of the fields as to whether they are filled in and whether the email address is valid.

Look over at Zend for some more complex scripts.
next step is validation mairving, im only still learning!
MulderMan is offline   Reply With Quote
Reply

Bookmarks

Still Need Help? Type Your Keywords Here:


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 06:50 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 PL2