Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

HTML Forum


You are currently viewing our HTML Forum as a guest. Please register to participate.
Login



Post a Project »

Find a Professional HTML Freelancer!

Find a Freelancer to help you with your HTML projects

FREE Outsourcing eBook!

Reply
I need help creating different forms.
Old 06-01-2010, 05:43 PM I need help creating different forms.
Novice Talker

Posts: 6
Name: Andy
Trades: 0
Hello guys,
I am new on the forum but I was flipping through the posts and you guys seem to be very helpful . Anyways, I have just created my very first website and it is centered around being a website where people can come to order content (I am a freelance article writer). Anyways like every good website, I need a "contact us" form, but I also need a form where people can order "custom content." I need the form to email to an email that I provide, most of the form codes I have tried failed to email me the form.

Any help is greatly appreciated as I am new to the world of owning a website
pacman15 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 06-01-2010, 09:53 PM Re: I need help creating different forms.
Marik's Avatar
Skilled Talker

Posts: 99
Trades: 0
Does your web server support PHP? If it does then you can try this (just save it as a file with a .php extension):

PHP Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <style type="text/css">
    body {
        font-family: arial;
    }
    .contactForm {
        border: 1px solid #ccc;
        padding: 15px;
        margin: auto;
    }
    .contactForm td {
        padding: 0 55px 10px 0;
    }
    h1 {
        font-size: 23px;
        margin: 0;
    }
    .text {
        border: 1px solid #999;
        width: 260px;
        height: 25px;
    }
    textarea {
        border: 1px solid #999;
        width: 420px;
        height: 200px;
    }
    .error {
        color: #f00;
        font-size: 13px;
        font-weight: bold;
    }
    </style>
  </head>
  <body>
    <?php

    
// turn off error reporting
    
error_reporting(0);

    
// user submitted form variables
    
$name    $_POST['name'];
    
$email   $_POST['email'];
    
$subject $_POST['subject'];
    
$message $_POST['message'];
    
$submit  $_POST['submit'];

    if(isset(
$submit)) {

        if(!
$name)
            
$error1 "<span class='error'>Required: Name</span><br />";
        if (!
$email)
            
$error2 "<span class='error'>Required: Email</span><br />";
        if(
strpos($email'@') == 0)
            
$error3 "<span class='error'>Invalid Email</span><br />";
        if(!
$subject)
            
$error4 "<span class='error'>Required: Subject</span><br />";
        if(!
$message)
            
$error5 "<span class='error'>Required: Message</span><br />";

        if(
strpos($email'@') == 1) {

            if(
$name && $email && $subject && $message) {
                
// send email
                
$sendMail mail("ENTER - YOUR - EMAIL - HERE"$subject$message"from: $email");

                
// display success or fail message
                
if($sendMail)
                    echo 
"<div style='border:2px solid green;width:300px;margin:auto;margin-bottom:25px;text-align:center;padding:5px;'>Your message has been sent.</div>";
                else
                    echo 
"<div style='border:2px solid red;width:300px;margin:auto;margin-bottom:25px;text-align:center;padding:5px;'>Message could not be sent.</div>";

            }

        }

    }

    
?>
    
    <form action="" method="POST">
    <table class="contactForm">
        <tr>
            <td>&nbsp;</td>
            <td><h1>Contact Us</h1></td>
        </tr>
        <tr>
            <td><label>Name:</label></td>
            <td><?php echo $error1?><input type="text" class="text" name="name" value="<?php echo $name?>" /></td>
        </tr>
        <tr>
            <td><label>Email:</label></td>
            <td><?php echo $error2?><?php echo $error3?><input type="text" class="text" name="email" value="<?php echo $email?>" /></td>
        </tr>
        <tr>
            <td><label>Subject:</label></td>
            <td><?php echo $error4?><input type="text" class="text" name="subject" value="<?php echo $subject?>" /></td>
        </tr>
        <tr>
            <td><label>Message:</label></td>
            <td><?php echo $error5?><textarea name="message"><?php echo $message?></textarea></td>
        </tr>
        <tr>
            <td>&nbsp;</td>
            <td><input type="submit" name="submit" value="Send Message" /></td>
        </tr>
    </table>
    </form>
    
  </body>
</html>
In the script replace this part:

Quote:
ENTER - YOUR - EMAIL - HERE
with your email address.

Last edited by Marik; 06-01-2010 at 09:56 PM..
Marik is offline
Reply With Quote
View Public Profile
 
Old 06-01-2010, 10:19 PM Re: I need help creating different forms.
Banned

Posts: 1
Trades: 0
Hi

Everyone i am new on the forum. And i just want to more about this site???
drleber is offline
Reply With Quote
View Public Profile Visit drleber's homepage!
 
Old 06-02-2010, 01:25 PM Re: I need help creating different forms.
Novice Talker

Posts: 6
Name: Andy
Trades: 0
That code did not work when I posted into my html editor. I need an contact us form that works, that has:
a "full name" field
a "email" field
a text area
and a submit button that submits the form to abrusnahan@atbarticles.com

Then I need an "Order Content" form with:
Full Name field
Email Field
Number of Articles field
drop down box with eight options
a text area
and a submit button that sends form to orderarticle@atbarticles.com

I want the text area in the "Order Content" form to say in the box, "Please include any title suggestions, keywords and any other relevant information to your article order." But I want that text set up to where the user can just click the box and it disappears so he or she can start typing.
pacman15 is offline
Reply With Quote
View Public Profile
 
Old 06-02-2010, 01:29 PM Re: I need help creating different forms.
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,380
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Quote:
That code did not work when I posted into my html editor.
Well it won't!

It needs to be opened in a browser after being placed on a server that supports PHP.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 06-02-2010, 01:43 PM Re: I need help creating different forms.
kline11's Avatar
SearchBliss Web Tools

Posts: 1,788
Name: John
Location: USA
Trades: 0
Quote:
Originally Posted by pacman15 View Post
That code did not work when I posted into my html editor. I need an contact us form that works, that has:
a "full name" field
a "email" field
a text area
and a submit button that submits the form to abrusnahan@atbarticles.com

Then I need an "Order Content" form with:
Full Name field
Email Field
Number of Articles field
drop down box with eight options
a text area
and a submit button that sends form to orderarticle@atbarticles.com

I want the text area in the "Order Content" form to say in the box, "Please include any title suggestions, keywords and any other relevant information to your article order." But I want that text set up to where the user can just click the box and it disappears so he or she can start typing.
If you have a Windows server AND can't run PHP, then use vbScript (ASP) or ASP.net. Here's a good ASP version: http://www.brainjar.com/asp/formmail/
And like Chris said above, this too is server side scripting.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

Last edited by kline11; 06-02-2010 at 01:44 PM..
kline11 is offline
Reply With Quote
View Public Profile
 
Old 06-02-2010, 02:17 PM Re: I need help creating different forms.
Novice Talker

Posts: 6
Name: Andy
Trades: 0
Okay, I will try that, my hosting uses cpanel. Anyways I still need to know how to make the text area say "Please include any title suggestions, keywords and any other relevant information to your article order." and then disappear whenever a user clicks into the box
pacman15 is offline
Reply With Quote
View Public Profile
 
Old 06-02-2010, 02:24 PM Re: I need help creating different forms.
LadynRed's Avatar
Defies a Status

Posts: 10,017
Location: Tennessee
Trades: 0
A different option is to use something like Wufoo - http://wufoo.com/
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Old 06-06-2010, 12:45 PM Re: I need help creating different forms.
Novice Talker

Posts: 6
Name: Andy
Trades: 0
Here is a form that I have tried to build. I dont remember where I got the code, but I just edited to say what I want. The problem I have with this code is that when I click submit, it opens up windows live email or whatever and I just want it to send the form to my email (orderarticle@atbarticles.com). I am planning on building a thank you page that it can redirect users to after they click submit, so I also need a place to put that in once I build it.
[PHP]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head>
<meta content="text/html; charset=unicode" http-equiv="Content-Type"><form method="post" action="mailtorderarticle@atbarticles.com" enctype="text/plain" onsubmit=" return formbreeze_sub()" name="form1" >
<meta name="GENERATOR" content="MSHTML 8.00.7600.16535">
<!-- FORMBREEZE-BEGIN - Do not modify these lines directly. -->
<!-- To change your form validation, visit http://www.formbreeze.com. -->
<script language="JavaScript">
<!--
var b = 0 ;
var i = 0 ;
var errmsg = "" ;
var punct = "" ;
var min = 0 ;
var max = 0 ;
function formbreeze_email(field) {
if (b && (field.value.length == 0)) return true ;

if (! emailCheck(field.value))
{
field.focus();
if (field.type == "text") field.select();
return false ;
}
return true ;
}
function formbreeze_filledin(field) {
if (b && (field.value.length == 0)) return true;
if (field.value.length < min) {
alert(errmsg);
field.focus();
if (field.type == "text") field.select();
return false ;
}
if ((max > 0) && (field.value.length > max)) {
alert(errmsg);
field.focus();
if (field.type == "text") field.select();
return false ;
}
return true ;
}
function formbreeze_number(field) {
if (b && (field.value.length == 0)) return true ; ;
if (i)
var valid = "0123456789"
else
var valid = ".,0123456789"
var pass = 1;
var temp;
for (var i=0; i<field.value.length; i++) {
temp = "" + field.value.substring(i, i+1);
if (valid.indexOf(temp) == "-1") pass = 0;
}
if (!pass) {
alert(errmsg);
field.focus();
if (field.type == "text") field.select();
return false;
}
if (field.value < min) {
alert(errmsg);
field.focus();
if (field.type == "text") field.select();
return false;
}

if ((max > 0) && (field.value > max)) {
alert(errmsg);
field.focus();
if (field.type == "text") field.select();
return false;
}
return true ;
}

function formbreeze_numseq(field) {

if (b && (field.value.length == 0)) return true ;
var valid = punct + "0123456789"
var pass = 1;
var digits = 0
var temp;
for (var i=0; i<field.value.length; i++) {
temp = "" + field.value.substring(i, i+1);
if (valid.indexOf(temp) == "-1") pass = 0;
if (valid.indexOf(temp) > (punct.length-1) ) digits++ ;
}
if (!pass) {
alert(errmsg);
field.focus();
if (field.type == "text") field.select();
return false ; ;
}
if (digits < min) {
alert(errmsg);
field.focus();
if (field.type == "text") field.select();
return false;
}
if ((max > 0) && (digits > max)) {
alert(errmsg);
field.focus();
if (field.type == "text") field.select();
return false;
}
return true ;
}
function emailCheck (emailStr) {

var checkTLD=1;
var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|c oop|info|pro|museum|ws)$/;
var emailPat=/^(.+)@(.+)$/;
var specialChars="
pacman15 is offline
Reply With Quote
View Public Profile
 
Old 06-06-2010, 12:47 PM Re: I need help creating different forms.
Novice Talker

Posts: 6
Name: Andy
Trades: 0
That code copied wrong, so here it is again. I hope its correct this time. One minor note to add, if there is anything in this code that is just making it complicated and I do not need it, then get rid of it.


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head>
<meta content="text/html; charset=unicode" http-equiv="Content-Type"><form method="post" action="mailtorderarticle@atbarticles.com" enctype="text/plain" onsubmit=" return formbreeze_sub()" name="form1" >
<meta name="GENERATOR" content="MSHTML 8.00.7600.16535">
<!-- FORMBREEZE-BEGIN - Do not modify these lines directly. -->
<!-- To change your form validation, visit http://www.formbreeze.com. -->
<script language="JavaScript">
<!--
var b = 0 ;
var i = 0 ;
var errmsg = "" ;
var punct = "" ;
var min = 0 ;
var max = 0 ;
function formbreeze_email(field) {
if (b && (field.value.length == 0)) return true ;

if (! emailCheck(field.value))
{
field.focus();
if (field.type == "text") field.select();
return false ;
}
return true ;
}
function formbreeze_filledin(field) {
if (b && (field.value.length == 0)) return true;
if (field.value.length < min) {
alert(errmsg);
field.focus();
if (field.type == "text") field.select();
return false ;
}
if ((max > 0) && (field.value.length > max)) {
alert(errmsg);
field.focus();
if (field.type == "text") field.select();
return false ;
}
return true ;
}
function formbreeze_number(field) {
if (b && (field.value.length == 0)) return true ; ;
if (i)
var valid = "0123456789"
else
var valid = ".,0123456789"
var pass = 1;
var temp;
for (var i=0; i<field.value.length; i++) {
temp = "" + field.value.substring(i, i+1);
if (valid.indexOf(temp) == "-1") pass = 0;
}
if (!pass) {
alert(errmsg);
field.focus();
if (field.type == "text") field.select();
return false;
}
if (field.value < min) {
alert(errmsg);
field.focus();
if (field.type == "text") field.select();
return false;
}

if ((max > 0) && (field.value > max)) {
alert(errmsg);
field.focus();
if (field.type == "text") field.select();
return false;
}
return true ;
}

function formbreeze_numseq(field) {

if (b && (field.value.length == 0)) return true ;
var valid = punct + "0123456789"
var pass = 1;
var digits = 0
var temp;
for (var i=0; i<field.value.length; i++) {
temp = "" + field.value.substring(i, i+1);
if (valid.indexOf(temp) == "-1") pass = 0;
if (valid.indexOf(temp) > (punct.length-1) ) digits++ ;
}
if (!pass) {
alert(errmsg);
field.focus();
if (field.type == "text") field.select();
return false ; ;
}
if (digits < min) {
alert(errmsg);
field.focus();
if (field.type == "text") field.select();
return false;
}
if ((max > 0) && (digits > max)) {
alert(errmsg);
field.focus();
if (field.type == "text") field.select();
return false;
}
return true ;
}
function emailCheck (emailStr) {

var checkTLD=1;
var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|c oop|info|pro|museum|ws)$/;
var emailPat=/^(.+)@(.+)$/;
var specialChars="
pacman15 is offline
Reply With Quote
View Public Profile
 
Old 06-06-2010, 12:47 PM Re: I need help creating different forms.
Novice Talker

Posts: 6
Name: Andy
Trades: 0
Dang it did it again, oh well, if somebody can help me then just email me at abrusnahan@yahoo.com or PM on here
pacman15 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to I need help creating different forms.
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.49858 seconds with 12 queries