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

How do I create an easy to use web form?


  • Please log in to reply

#1
Matt T

Matt T

    Member

  • Member
  • PipPipPip
  • 674 posts
Hello,

I would like to create an easy to code web form. Could anyone help me? I just need it for like feedback etc. Would it be possible for it to send the data to an e-mail address?

Thankyou for your help,

~Matt :whistling:

Edited by Matt T, 16 December 2007 - 09:49 PM.

  • 0

Advertisements


#2
TaNkZ101

TaNkZ101

    Member

  • Member
  • PipPipPip
  • 327 posts
you need to use a server scripting technology such as php. here's an example form and script to go with it.
<form action="mail.php" method="post">
E-mail:
<input type="text" name="email">
First name: 
<input type="text" name="firstname">
<br>
Last name: 
<input type="text" name="lastname">
Input/feedback:
<textarea rows="10" cols="30" name="feedback">
Enter feedback here
</textarea>
<input type="submit" value="Send">
<input type="reset" value="Reset">
</form>
as you can see, along with every input it is mandatory to use the name attribute. this is how the php will get the variables- the names become the names of the variables.
<html>
<body><?php

  //send email
  $email = $_REQUEST['email']; 
  $subject = site feedback;
  $feedback = $_REQUEST['feedback'];
  $firstname = $_REQUEST['firstname'];
  $lastname = $_REQUEST['lastname'];
  $message = "$firstname $lastname sends you the following message \n $message";
  mail( "[email protected]", "Subject: $subject", $message, "From: $email" );
  //message displayed on the user's screen
  echo "Thank you for using our mail form";

 ?>
</body>
</html>
i haven't tested it, however i wouldn't give this to u if i didn't think it works. test it, post the results (if any). there's a form section in www.w3schools.com's html tutorial, and a php mail section in its php tutorial.

Edited by TaNkZ101, 29 July 2006 - 03:25 AM.

  • 0

#3
Allsortgroup

Allsortgroup

    I SPAMMED Too Much!

  • Banned
  • PipPipPip
  • 905 posts
Theres a good one here...

http://www.kirupa.co...ontact_form.htm
  • 0

#4
Matt T

Matt T

    Member

  • Topic Starter
  • Member
  • PipPipPip
  • 674 posts
Thankyou TaNkZ101, I tried what you suggested and Firefox said the file wasn't found because I couldn't get notepad to save it with a .php extenstion it put it as blahblah.php.txt. I went to the site that you reccomended w3schools.com and I didn't really understand the site.

Thankyou Allsortshop,

I tried that website link and it was very informative. I set all the files up on my websever but because it is free it doesn't support php (great) and this message comes up:

You have accessed a filetype or folder that must be served from a CGI server. This means that this file may exist, but if the site isn't upgraded for CGI, it cannot be served. To avoid this message, do not name your files with a .php, .cgi, or .pl extension, and don't store them in a folder named cgi-bin.

Does anyone know of a way to get around this or to get the script to automatically e-mail it to me preferbly without having to use the persons mail program (I know I am picky).

Thanks you guys for your help,
~Matt :whistling:

Edited by Matt T, 16 December 2007 - 09:50 PM.

  • 0

#5
TaNkZ101

TaNkZ101

    Member

  • Member
  • PipPipPip
  • 327 posts
you can use asp to do it, but if your server doesn't support php i doubt it supports asp. or maybe cgi? i don't know. if your server doesn't support scripting, then if you HAVE to have the contact/feedback form, you could use html's "mailto:" function, or pick another host (www.free-webhosts.com has a database, including what they offer.)
here is an example with the form's 'mailto' attribute. Beware, it is supposedly extremely unreliable.
<html>
<body>
<form action="MAILTO:[email protected]" method="post" enctype="text/plain">

<h3>This form sends an e-mail to W3Schools.</h3>
Name:<br>
<input type="text" name="name"
value="yourname" size="20">
<br>
Mail:<br>
<input type="text" name="mail"
value="yourmail" size="20">
<br>
Comment:<br>
<textarea rows="10" cols="30" name="feedback">
Enter feedback here
</textarea>
<br><br>
<input type="submit" value="Send">
<input type="reset" value="Reset">

</form>
</body>
</html>

  • 0

#6
Matt T

Matt T

    Member

  • Topic Starter
  • Member
  • PipPipPip
  • 674 posts
Thankyou TaNk101,

I'll try that free web host that you reccomended. I have tried a html script just like the one you posted, but the reason I don't want to use a script like that is because the person who was sending feedback would have to have a mail program and an account set up with it. I could use it though if nothing else worked.

Edited by Matt T, 16 December 2007 - 09:51 PM.

  • 0

#7
Elliot23

Elliot23

    New Member

  • Member
  • Pip
  • 4 posts
Probably you can save your time using form creator, because it takes a lot of time to do it yourself.
  • 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