Help with contact form

TheOutfit

New Member
Messages
24
Reaction score
0
Points
0
IDK whats wrong as i am not looking at your code but follow this tut

Step 1: Copy and paste the e-mail Form Code into a 'contact.php' page (must be a html/php page on a server that allows php!).

Step 2: Copy n paste the sendeail.php code into a new file. Change the YourEmail section to include your email address. Then check (or modify) the link at the bottom (contact.php) to point to the desired Next Page. Save the file as 'sendeail.php' (as ASCII file).

Step 3: Upload both files as ASCII i.e. upload the same way as .html files. Be sure both files are in the same folder on the server.


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Email Form </title>
</head>
<body>

<form method="post" action="sendeail.php">

<!-- DO NOT change ANY of the php sections -->
<?php
$ipi = getenv("REMOTE_ADDR");
$httprefi = getenv ("HTTP_REFERER");
$httpagenti = getenv ("HTTP_USER_AGENT");
?>

<input type="hidden" name="ip" value="<?php echo $ipi ?>" />
<input type="hidden" name="httpref" value="<?php echo $httprefi ?>" />
<input type="hidden" name="httpagent" value="<?php echo $httpagenti ?>" />


Your Name: <br />
<input type="text" name="visitor" size="35" />
<br />
Your Email:<br />
<input type="text" name="visitormail" size="35" />
<br /> <br />
<br />
Attention:<br />
<select name="attn" size="1">
<option value=" Sales n Billing ">Sales n Billing </option>
<option value=" General Support ">General Support </option>
<option value=" Technical Support ">Technical Support </option>
<option value=" Webmaster ">Webmaster </option>
</select>
<br /><br />
Mail Message:
<br />
<textarea name="notes" rows="4" cols="40"></textarea>
<br />
<input type="submit" value="Send Mail" />
<br />
</form>

</body>
</html>

-
code for sendeail.php


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Sendemail Script</title>
</head>
<body>

<!-- Reminder: Add the link for the 'next page' (at the bottom) -->
<!-- Reminder: Change 'YourEmail' to Your real email -->

<?php

$ip = $_POST['ip'];
$httpref = $_POST['httpref'];
$httpagent = $_POST['httpagent'];
$visitor = $_POST['visitor'];
$visitormail = $_POST['visitormail'];
$notes = $_POST['notes'];
$attn = $_POST['attn'];


if (eregi('http:', $notes)) {
die ("Do NOT try that! ! ");
}
if(!$visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,".")))
{
echo "<h2>Use Back - Enter valid e-mail</h2>\n";
$badinput = "<h2>Feedback was NOT submitted</h2>\n";
echo $badinput;
die ("Go back! ! ");
}

if(empty($visitor) || empty($visitormail) || empty($notes )) {
echo "<h2>Use Back - fill in all fields</h2>\n";
die ("Use back! ! ");
}

$todayis = date("l, F j, Y, g:i a") ;

$attn = $attn ;
$subject = $attn;

$notes = stripcslashes($notes);

$message = " $todayis [EST] \n
Attention: $attn \n
Message: $notes \n
From: $visitor ($visitormail)\n
Additional Info : IP = $ip \n
Browser Info: $httpagent \n
Referral : $httpref \n
";

$from = "From: $visitormail\r\n";


mail("YourEmail", $subject, $message, $from);

?>

<p align="center">
Date: <?php echo $todayis ?>
<br />
Thank You : <?php echo $visitor ?> ( <?php echo $visitormail ?> )
<br />

Attention: <?php echo $attn ?>
<br />
Message:<br />
<?php $notesout = str_replace("\r", "<br/>", $notes);
echo $notesout; ?>
<br />
<?php echo $ip ?>

<br /><br />
<a href="contact.php"> Next Page </a>
</p>

</body>
</html>

Hope this helps
 

dcoates

New Member
Messages
129
Reaction score
0
Points
0
I'll give it a shot

Thanks
Edit:
Don't know what I did wrong but when I click send I get this error "Warning: mail() has been disabled for security reasons in /home/dcoates/public_html/sendeail.php on line 59"

I'm no ood with php so I got lost when I seen this. Probably something stupid I didn't do LOL.
 
Last edited:

tittat

Active Member
Messages
2,478
Reaction score
1
Points
38
"Warning: mail() has been disabled for security reasons in /home/dcoates/public_html/sendeail.php on line 59"

if so try upgrading your php to intermediate version.It can be done via your account panel.
 

dcoates

New Member
Messages
129
Reaction score
0
Points
0
how do I do that??

and do I have to create a database or something?

and ever since I put this script in the only link that works in my site is my contact page every other link is broken.

Thanks Doug
 
Last edited:

sumitmehta

New Member
Messages
215
Reaction score
1
Points
0
You don't have to create a database for it. There must be some option which you have to click in the control panel to upgrade your php.
 

dcoates

New Member
Messages
129
Reaction score
0
Points
0
ok got my links working. but the error thing I can't find an option to upgrade php?

lost with PHP but the error sounds like it's in the coding its syas in sendeail.php on line 59.
 

Mitch

New Member
Messages
908
Reaction score
0
Points
0
PHP:
<html>
<head>
<title>MITCH.EXOFIRE.NET</title>
<link href="http://mitch.exofire.net/style.css" type="text/css" rel="stylesheet">
<?php  

if ($_POST['submit'] == TRUE) {  
    $receiverMail = "mitchhubers@gmail.com";  
    $name        = stripslashes(strip_tags($_POST['name']));  
    $email        = stripslashes(strip_tags($_POST['email']));  
    $subject    = stripslashes(strip_tags($_POST['subject']));  
    $msg        = stripslashes(strip_tags($_POST['msg']));  
    $ip            = $_SERVER['REMOTE_ADDR'];  
    $msgformat    = "Van: $name ($ip)\nEmail: $email\n\n$msg";  
    $file        = stripslashes(strip_tags($_POST['file']));
    
    if(empty($name) || empty($email) || empty($subject) || empty($msg)) {  
        echo "<center><h2>The email isn't sent</h2><p>Fill all fields in.</p><b><a href=\"javascript: history.go(-1)\">Back</a></b></center>";  
    }  
    elseif(!ereg("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)) {  
        echo "<center><h2>De email is niet verzonden</h2><p>The email adress is invalid</p><b><a href=\"javascript: history.go(-1)\">Back</a></b></center>";  
    }  
    elseif(mail($receiverMail, $subject, $msgformat, "Van: $name <$email>, $file")) {  
        echo "<center><h2>The email is sent!</h2><div><p>You will get so soon als possible a email back.</p></center>"; }  
    else {  
        echo "<center><h2>The email isn't sent</h2><p>Try it a other time again... If the problem still showing up it will be the server or a mistake in the script.</p><b><a href=\"javascript: history.go(-1)\">Back</a></b></center>";  
    }  
}  
else { ?> 
<style type="text/css">
.style1 {
	color: #FFFFFF;
}
</style>
</head>
<body bgcolor="#1E3F62">



<form method="POST" action="" style="text-decoration: none; color: #000000; font-family: Comic Sans MS" enctype="multipart/form-data">
<label for="name"><font size="6" color="#FFFFFF">
	<p align="center">Contact MITCH</font></label><span class="style1"><font size="6">.EXOFIRE.NET</font></span><p align="center">
	<font color="#FFFFFF">
	&nbsp;</font><font color="#FFFFFF">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
    Name: </font>
	<input id="name" name="name" type="text" size="35" maxlength="40" style="text-decoration: none; color: #000000; font-family: Comic Sans MS" /><font color="#FFFFFF">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />

	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Email:
	</font>
	<input id="email" name="email" type="text" size="35" maxlength="40" style="text-decoration: none; color: #000000; font-family: Comic Sans MS; margin-top:1; margin-bottom:0" />
	<font color="#FFFFFF">&nbsp;&nbsp;</font><font color="#FFFFFF">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />
  &nbsp;</font><font color="#FFFFFF">Subject: </font>
    <input id="subject" name="subject" type="text" size="35" maxlength="40" style="text-decoration: none; color: #000000; font-family: Comic Sans MS; margin-top: 2" />
    <font color="#FFFFFF">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />
    <label for="message">Message:</label>
    <textarea id="message" name="msg" cols="68" rows="6" style="text-decoration: none; color: #000000; font-family: Comic Sans MS; margin-top: 5"></textarea>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;    </font>
    <input name="min" type="button"" value="-" style="margin-top:3; color:#000000; font-family:Comic Sans MS; width: 22px;" class="cursor" onclick="document.getElementById('message').rows -= 3;" title="Decrease The Textarea">
    <input id="submit" class="button" type="submit" color="#000000" name="submit" value="Send" style="margin-top:3; color:#000000; font-family:Comic Sans MS" />
    <font color="#FFFFFF">
	<input type="reset" value="Delete Input" name="wissen" style="color: #000000">&nbsp;<input name="plus" type="button" value="+" style="margin-top:3; color:#000000; font-family:Comic Sans MS; width: 22px;" class="cursor" onclick="document.getElementById('message').rows += 3;" title="Increase The Textarea">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></p>
<p align="center">
	<font color="#FFFFFF">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <a target="_blank" href="http://mitch.exofire.net/download/download.php?fname=./contact.zip">Click here if you want this script!</a></font></p>
</form>
<?php } ?>
</body>
</html>
I use this script as contact form
 

TechAsh

Retired
Messages
5,853
Reaction score
7
Points
38
Login to the account panel (http://www.x10hosting.com/login) then you should find a option to upgrade PHP to Version 2 (Intermediate).
Note - It may take 48 hours for your request to be approved.

Once your request has been approved the script will work.
 
Last edited:

dcoates

New Member
Messages
129
Reaction score
0
Points
0
ok I found the upgrade.

I hope this works.got my fingers crossed.

Thanks
 
Top