Be a Supporter!

forms.. help please

  • 513 Views
  • 15 Replies
New Topic Respond to this Topic
Kyzaskiwi
Kyzaskiwi
  • Member since: Apr. 21, 2004
  • Offline.
Forum Stats
Member
Level 08
Blank Slate
forms.. help please 2005-06-24 17:53:20 Reply

im not new to webpages but I have always just stuck to html.. Now a friend is making a new site and i wanted to make a form where someone can submit stuff (much like the form i am typing in now cept its not for a forum)... and when it submits, it gets sent to you e-mail.. I know that using the mailto action in html forms wont work for alot of browsers and i have heard of needing a cgi, but this is stuff i dont know about.. it seems like a simple idea to make a basic form that submits to e-mail but i cant figure it out, can anyone help?

Craige
Craige
  • Member since: Jul. 17, 2004
  • Offline.
Forum Stats
Member
Level 08
Blank Slate
Response to forms.. help please 2005-06-24 18:09:49 Reply

If your host supports PHP, you can to the script in php with the mail() function. If they support PHP, say so here, and ill write you a script.

PhoenixJ
PhoenixJ
  • Member since: Jul. 10, 2003
  • Offline.
Forum Stats
Member
Level 15
Blank Slate
Response to forms.. help please 2005-06-24 18:16:24 Reply

Mailto works in most browsers. Either way, you'd need PHP or CGI to do it


BBS Signature
Kyzaskiwi
Kyzaskiwi
  • Member since: Apr. 21, 2004
  • Offline.
Forum Stats
Member
Level 08
Blank Slate
Response to forms.. help please 2005-06-24 18:26:02 Reply

well i dont really want to deal with php but do you know of any cgi's free to download that could malto a yahoo adress?

PhoenixJ
PhoenixJ
  • Member since: Jul. 10, 2003
  • Offline.
Forum Stats
Member
Level 15
Blank Slate
Response to forms.. help please 2005-06-24 18:36:46 Reply

Does your server support PHP? Because there are plenty of premade scripts


BBS Signature
Kyzaskiwi
Kyzaskiwi
  • Member since: Apr. 21, 2004
  • Offline.
Forum Stats
Member
Level 08
Blank Slate
Response to forms.. help please 2005-06-24 18:49:02 Reply

well its not my server, its my friend, he has a paid hostultra domain name....

Goose31
Goose31
  • Member since: Jun. 22, 2005
  • Offline.
Forum Stats
Member
Level 05
Blank Slate
Response to forms.. help please 2005-06-24 18:58:11 Reply

On the Host Ultra site, http://www.hostultra.com, it says that paid plans (and free ones too) have PHP support.

nixopax
nixopax
  • Member since: Jan. 10, 2005
  • Offline.
Forum Stats
Member
Level 20
Programmer
Response to forms.. help please 2005-06-24 19:59:01 Reply

If it's on Hostultra, as said before, I'd strongly suggest using PHP. it's faster than CGI.

So, here's a simple method:

On your contact page:

<form action="mail.php" method="post">
Email: <input type="text" name="email"><br>
Name: <input type="text" name="name"><br>
Subject: <input type="text" name="subject"><br>
Message: <textarea name="message" id="message"></textarea>
</form>

Since you know html, you should understand this. You should also know how to make it prettier, and add more text inputs if necessary.

now, make a new page called mail.php
You'll need this basic code.

<?php
$recipient = "email@yahoo.com"; //This is where you put your email address
$subject = $_POST['subject']; //Gets the subject of the message
$name = $_POST['name']; //Gets the title of the sender
$email = $_POST['email']; //Gets the email of the sender
$message = $_POST['message']; //Gets the message of the sender
$body = "Hello Joe,\n My name is " . $name . ", and this is my message:\n" . $message . "\n You can contact me at " . $email;
mail($recipient, $subject, $body, "From: $email");
?>

There, simple as that. If you have any questions, there are plenty of people here that can help you with this sort of thing.

AntiangelicAngel
AntiangelicAngel
  • Member since: Feb. 23, 2004
  • Offline.
Forum Stats
Member
Level 19
Blank Slate
Response to forms.. help please 2005-06-25 06:43:01 Reply

I made mine with Adobe Pagemill. What can I say? I'm a bum. If you download any demo web page thing it should work. Just copy the HTML off that, and change the submit buttons address to an email.

Kyzaskiwi
Kyzaskiwi
  • Member since: Apr. 21, 2004
  • Offline.
Forum Stats
Member
Level 08
Blank Slate
Response to forms.. help please 2005-06-25 10:38:02 Reply

yeah i get the html, you are saying the php is that easy? wow i need to learn myself some new languages.. ive been so preocupied with learning java and c++ for school (computer science major going into game programming) that i forgot about the other languages. it would probably help to learn them tho given i am a comp sci major.. lol, but thanks anyways you have been a big help

Kyzaskiwi
Kyzaskiwi
  • Member since: Apr. 21, 2004
  • Offline.
Forum Stats
Member
Level 08
Blank Slate
Response to forms.. help please 2005-06-25 11:04:30 Reply

it worked perfectly.. and as php is similar to java and c++ i was able to play with the php tags to work exactly how i wanted.. I cant believe i was searching the internet all day yesterday to find something and that was all i needed. Thing is i cant see if the php actually works yet cuz i lost my friends password to hostultra like an idiot, lol... and i dont think notepad can save something as a php.. but as soon as it gets up it should work and if not im pretty good at troubleshooting (not to mention that after looking at the php code i understand what almost everything in it is)....

anyways i was wondering now, if anyone knew the code to make a page username and password protected. you know make them have to sign in to get to it? like we do with newgrounds.. im sure its more difficult.. i kinda know how but not sure how that code goes about searching and storing usernames and passwords... ill look it up but if you guys know it would be a big help

Kyzaskiwi
Kyzaskiwi
  • Member since: Apr. 21, 2004
  • Offline.
Forum Stats
Member
Level 08
Blank Slate
Response to forms.. help please 2005-06-25 14:07:46 Reply

I HAVE encountered a problem. After they press submit, it e-mails to me fine, but it just goes to a blank page.. any way to redirect it to a site?

Goose31
Goose31
  • Member since: Jun. 22, 2005
  • Offline.
Forum Stats
Member
Level 05
Blank Slate
Response to forms.. help please 2005-06-25 14:23:48 Reply

One way to fix that is to have the user click the sumbit button and be sent to a redirection page, the redirection page then would send the user to the homepage, or whatever.

Kyzaskiwi
Kyzaskiwi
  • Member since: Apr. 21, 2004
  • Offline.
Forum Stats
Member
Level 08
Blank Slate
Response to forms.. help please 2005-06-25 14:27:12 Reply

still new with forms so what can i do with the submit button to send it to a redirect page, and how do i build a redirect page (sorry i am really new to anyhting but html i have only been using html till now... well im not that new i understand the codes but i just dont know them)

nixopax
nixopax
  • Member since: Jan. 10, 2005
  • Offline.
Forum Stats
Member
Level 20
Programmer
Response to forms.. help please 2005-06-25 16:17:18 Reply

<meta http-equiv="refresh" content="5;URL=thisurl.htm">

Put that in the <head>

Content is # of seconds. thisurl.htm is the destination.

And some confirmation text in your <body>:

Thanks for your input, Please wait as you're redirected.

Kyzaskiwi
Kyzaskiwi
  • Member since: Apr. 21, 2004
  • Offline.
Forum Stats
Member
Level 08
Blank Slate
Response to forms.. help please 2005-06-25 16:19:05 Reply

actually i fixed it by doing an echo in the php that told it to go to a site where i thank them for submission blah blah and gave them links to go elsewhere..

thanks for all the help tho