Jump to content

mailto onclick send


spudly1987

Recommended Posts

I have the following contact box, and I want to be able to make it so that when you click on Send, it will send the information to an email address. I'm not sure if this needs to be done with php or just adding something like mailto:example@example.com 

 

any assistance would be appreciated

<body bgcolor="black">
        <div id="form-wrapper" class="myform">
            <form id="form" name="form" method="post" action="index.html">

                <p>For Fan Mail And Other Fun Things, Contact Me Here.</p>
 
                <label for="name">Name
                    <span class="small">(Required)</span>
                </label>
                <input type="text" name="name" id="name" />
 
                <label for="email">E-mail Address
                    <span class="small">(Required)</span>
                </label>
                <input type="text" name="email" id="email" />
 
                <label for="subject">Subject
                    <span class="small">(Required)</span>
                </label>
                <input type="text" name="subject" id="subject" />
 
                <label for="message">Message
                    <span class="small">(Required)</span>
                </label>
                <textarea name="message" id="message"                  rows="5"></textarea>
 
                <button type="submit">Send</button>
                <div class="spacer"></div>
 
            </form>
        </div>
    </body>
Link to comment
Share on other sites

Okay so I think i'm missing something but not quite sure. I have the following contact form

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="ContactMe.php" />
<title>Contact Me</title>
<style>
 body{font-family:verdana, arial, helvetica, sans-serif;
 font-size:14px;
 }
 p, h1, form, button{border:0; margin:0; padding:0;}
 .spacer{clear:both; height:1px;}
 
            /* ----------- My Form ----------- */
            .myform{
                margin:0 auto;
                width:509px;
                padding:14px;
            }
 
            /* ----------- form-wrapper ----------- */
            #form-wrapper{
                background: none repeat scroll 0 0 #C6C6C6;
                border: 2px solid #8B8B8B;
                border-radius: 10px;
                -moz-border-radius: 10px;
                -op-border-radius: 10px;
                -webkit-border-radius: 10px;
            }
            #form-wrapper h1 {
                font-weight:bold;
                margin-bottom:8px;
            }
            #form-wrapper p{
                font-size:11px;
                color:#666666;
                margin-bottom:20px;
                border-bottom:solid 1px #7E7E7E;
                padding-bottom:10px;
            }
            #form-wrapper label{
                display:block;
                font-weight:bold;
                text-align:right;
                width:193px;
                float:left;
            }
            #form-wrapper .small{
                color:red;
                display:block;
                font-size:11px;
                font-weight:normal;
                text-align:right;
                width:193px;
            }
            #form-wrapper input,#form-wrapper textarea{
                float:left;
                border:solid 1px #aacfe4;
                width:284px;
                margin:2px 0 20px 10px;
                border-radius: 15px;
                -moz-border-radius: 15px;
                -op-border-radius: 15px;
                -webkit-border-radius: 15px;
                font-size: 14px;
            }
 
            #form-wrapper input{
                height: 25px;
                padding: 4px 10px;
            }
            #form-wrapper textarea{
                padding: 10px 10px;
                overflow: auto;
            }
            /* ----------- Form Button ----------- */
            #form-wrapper button {
               background: #2c3e4a;
               background: -webkit-gradient(linear, left top, left bottom, from(#919496), to(#2c3e4a));
               background: -webkit-linear-gradient(top, #919496, #2c3e4a);
               background: -moz-linear-gradient(top, #919496, #2c3e4a);
               background: -ms-linear-gradient(top, #919496, #2c3e4a);
               background: -o-linear-gradient(top, #919496, #2c3e4a);
               padding: 5px 10px;
               -webkit-border-radius: 15px;
               -moz-border-radius: 15px;
               border-radius: 15px;
               margin-left: 315px;
               color: white;
               font-size: 20px;
               text-decoration: none;
               vertical-align: middle;
            }
            #form-wrapper button:hover {
               background: #3d4b54;
               color: #ccc;
            }
        </style>
</head>
<body bgcolor="black">
        <div id="form-wrapper" class="myform">
            <form id="form" name="form" method="post" action="index.html">

                <p>For Fan Mail And Other Fun Things, Contact Me Here.</p>
 
                <label for="name">Name
                    <span class="small">(Required)</span>
                </label>
                <input type="text" name="name" id="name" />
 
                <label for="email">E-mail Address
                    <span class="small">(Required)</span>
                </label>
                <input type="text" name="email" id="email" />
 
                <label for="subject">Subject
                    <span class="small">(Required)</span>
                </label>
                <input type="text" name="subject" id="subject" />
 
                <label for="message">Message
                    <span class="small">(Required)</span>
                </label>
                <textarea name="message" id="message"                  rows="5"></textarea>
 
                <button type="submit" onclick="ContactMe.php">Send</button>
                <div class="spacer"></div>
             </form>
            </div>
    </body>
</html>

I also created a php form for the emailing

<?php

/* Subject and Email Variables */

	$emailSubject = 'Content Ordering!';
	$webMaster = 'spudly1987@gmail.com';
	
/* Gathering Data Variables */

	$nameField = $_POST('name');
	$emailField = $_POST('email');
	$subjectField = $_POST('subject');
	$messageField = $_POST('message');	
	
	$body = <<<EOD
<br><hr><br>
Name: $name <br>
Email: $email <br>
Subject: $subject <br>
Message: $message <br>
EOD;

	$headers = "From: $email\r\n";
	$headers .= "Content-type: text/html\r\n";
	$success = mail($webMaster, $emailSubject, $body, $headers);
	
/* Results rendered as HTML */

	$theResults = <<<EOD
<html>
<head>
<title>Untitled Document</title>
</head>
<body>
<center>Thank you for your submission, I will respond back to you shortly.</center>
</body>
</html>
EOD;
echo "$theResutls";

?>

and i have the results page i would like for it to post when completed 

<html>
<head>
<title>Untitled Document</title>
</head>
<body>
<center>Thank you for your submission, I will respond back to you shortly.</center>
</body>
</html>

How ever something is not being linked or set correctly any help would be greatly appreciated

Link to comment
Share on other sites

Okay I changed the following Action from index.html to my contactme.php page

<form id="form" name="form" method="post" action="ContactMe.php">

and now getting the following error 

 

Fatal error: Function name must be a string in /srv/disk9/1487284/www/modelcontent.eu.pn/ContactMe.php on line 10

Link to comment
Share on other sites

Put this after the opening php tag and see if it gives you any other errors.

error_reporting(E_ALL);

Depending on if this is on your local host or a paid hosting account, you may also need to turn on error reporting in the php.ini file.  If it's not on, the line above won't do any good.  Also if you're on localhost, do you have a mail server setup?  If not then t won't send mail anyway.

Link to comment
Share on other sites

I'm using a hosting site of 

 

http://freehostingeu.com

 

I have all of my files uploaded on to that site. 

 

my direct link to the site is 

 

http://modelcontent.eu.pn

 

and currently I'm just testing it with my g-mail email address. 

 

And also another issue i'm trying to fix, is the Spoil Me page is not loading up for some reason

Edited by spudly1987
Link to comment
Share on other sites

Are you Ashley?  I would guess the reason that the spoil page is not loading is cause you seem to name your files with uppercase letters but on the spoil.html it's all lowercase, so the server can't find that file, hence the 404 page not found error.

 

Your spelled results wrong

echo "$theResutls";
Link to comment
Share on other sites

okay when I click on send i am now getting the following post

 

Notice: Undefined variable: name in /srv/disk9/1487284/www/modelcontent.eu.pn/ContactMe.php on line 19

Notice: Undefined variable: email in /srv/disk9/1487284/www/modelcontent.eu.pn/ContactMe.php on line 20

Notice: Undefined variable: message in /srv/disk9/1487284/www/modelcontent.eu.pn/ContactMe.php on line 21

Notice: Undefined variable: email in /srv/disk9/1487284/www/modelcontent.eu.pn/ContactMe.php on line 24

Thank you for your submission, I will respond back to you shortly.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.