• Howdy! Welcome to our community of more than 130.000 members devoted to web hosting. This is a great place to get special offers from web hosts and post your own requests or ads. To start posting sign up here. Cheers! /Peo, FreeWebSpace.net
managed wordpress hosting

Help needed with contact form. Will return the favor!

build-a-host

321Hosted.com
NLC
Hello all,

I have been working on a new website to sell just VPS hosting packages. I'm about done but I'm stuck on the contact form. The website is http://vpspw.com and the contact form is located at http://vpspw.com/contact.html.

I need someone to give me the code I need to get this thing working so that it sends all emails to info (AT) vpspw (dot) com.

Here is the code for the contact form:

Code:
<form action="#" method="post" class="cmxform" id="contactform">
<fieldset class="cform">
<div>
<label for="name" class="overlabel">Name *</label>
<input type="text" name="name" id="name" class="box" />
</div>
<div>
<label for="email" class="overlabel">Email *</label>
<input type="text"  name="email" id="email" class="box" />
</div>
<div>
<label for="subject" class="overlabel">Subject *</label>
<input type="text" name="subject" id="subject" class="box"/>
</div>
<div>
<label for="message" class="overlabel">Message *</label>
<textarea name="message" id="message" cols="58" rows="10" class="box" /></textarea>
</div>
<div>
<label for="confirm" class="overlabel">What is <strong id="math1">927</strong> plus <strong id="math2">1</strong>? *</label>
<input type="text" name="confirm" id="confirm" class="box" />
</div>
<pre></pre>
<div class="loading"></div>
<div><input type="hidden" name="contactemail" id="contactemail" value="info@vpspw.com" /></div>
<div><a href=""  id="formsend" class="smbutton"><span>submit</span></a></div>
</fieldset>
</form>

I'll also need some sort of .php file that sends the emails so if you could also provide that I would appreciate it very much!

In return I can offer free graphics, free directory submissions, free social network submissions, a free shared or reseller account or a small amount of SEO work.

Thanks in advance!
 
Here is a basic version that you can use and customize for your use:

Code:
<form method="POST" action="contactmailer.php">
<table align="center" cellpadding="3">
<tr><td>Your Name: </td><td><input type="text" name="name" size="19"></td></tr>
<tr><td>Your Email: </td><td><input type="text" name="email" size="19"></td></tr>
<tr><td>Message: </td><td><textarea rows="9" name="message" cols="30"></textarea></td></tr>
<tr><td colspan="2" align="center"><input type="submit" value="Submit" name="submit"></td></tr>
</table>
</form>

And then you will need a php file, in this case "contactmailer.php" and it's setup as follows:

Code:
<?php

if(isset($_POST['submit'])) { 
$to = "youremail@yourdomain.com"; 
$subject = "SUBJECT GOES HERE"; 
$name_field = $_POST['name']; 
$email_field = $_POST['email']; 
$message = $_POST['message']; 
  
$body = "From: $name_field\n E-Mail: $email_field\n Message:\n $message"; 
  
echo "<p align=\"center\"><br /><br />Thank you! Your message has been sent!</p>"; 
mail($to, $subject, $body); 
} else { 
echo "blarg!"; 
} 

?>

Of course this is a basic form. I am not going to do all of the work for you, but you can take this and elaborate.
 
Thanks for the help!

I don't really need the whole new contact form. I would prefer to use the one that is already on the page but, I will try and incorporate the contactmailer.php file and see if that works.

Thanks again. I'll post back here and let you guys know if it worked or not.

EDIT:

Just tried it and it did not work. So, whoever can help me out with getting the current contact form working I will return the favor! I don't need a new contact form written, I just want to get the current one working.
 
Last edited:
As I mentioned already, you can't just point the form that you already have to my version of contactmailer.php and expect it to work. You have to use what I provided to you and then build upon it and update it with your specific form fields, etc. If you're looking for somebody to write the php function for you to work with what you already have, you'll have to get help elsewhere. I have provided you with the base code that will work in any scenario. You just have to adapt it to the fields that YOU want to use on your form.
 
Last edited:
I understand that. I tried to edit the contactmailer.php file to use with my currect contact form but, no luck.

I do understand that you're not willing to write the code needed to get the current contact form working but, I'm sure there is someone here that is willing to help. So, I see no need in going somewhere else.

Thanks for your time though!
 
<form action="#" method="post" class="cmxform" id="contactform" name="contactform">
<fieldset class="cform">
<div><label for="name" class="overlabel">Name *</label> <input type="text" name="name" id="name" class="box"></div>
<div><label for="email" class="overlabel">Email *</label> <input type="text" name="email" id="email" class="box"></div>
<div><label for="subject" class="overlabel">Subject *</label> <input type="text" name="subject" id="subject" class="box"></div>
<div><label for="message" class="overlabel">Message *</label> <textarea name="message" id="message" cols="58" rows="10" class="box"></div>
<div><label for="confirm" class="overlabel">What is <strong id="math1">927</strong> plus <strong id="math2">1</strong>? *</label> <input type="text" name="confirm" id="confirm" class="box"></div>
<div class="loading"></div>
<div><input type="submit" name="Submit" value="Submit"> <input type="reset" name="Submit2" value="Reset"></div>
</fieldset>
</form>
Where did you get that math question ? it uses a included file ? because I don't see the code generating the question.
I removed your hidden email because is not needed since email will be in php sendmail script.
The PHP script:
PHP:
<?php
$subject="$subject";
$message="$message";
$mail_from="$email";
$header="from: $name <$mail_from>";
$to='info@vpspw.com';
$send_contact=mail($to,$subject,$message,$header);
if($send_contact){
echo "We've received your contact information";
}
else {
echo "ERROR";
}
?>
 
Last edited:
The mast question, captcha, came included in the design. I don't see any included file that it reads from though.

Thanks a lot for the code! I am going to try it now and see if it works. I'll let you know what happens!

EDIT:
This code should be saved as contactmailer.php, correct?
 
Hmmm,,,no luck! One test I did showed up saying that there was an error. I guess I got the captcha question wrong (or so it said) but, every other test I did got no error message or confirmation. I did not receive and emails either so, it doesn't seem to be working.

The submit button doesn't seem to be doing anything.
 
You can save whatever you want. If you save it as send-contact.php then you have to change <form action="send-contact.php"
 
Thanks, I saved it as send-contact.php and changed the html code for the form to reflect that file name but, it still doesn't work. It seems that the submit button isn't doing anything.

By the way, I don't mind paying a little to get this working!
 
Just noticed that when I enter the captcha incorrectly, it shows an error message that tells me it's wrong but, when it is entered correctly, it seems to do nothing at all.
 
Ok, I edited the code and tested myself and got the message on gmail.
The form:
<form action="send-contact.php" method="post" class="cmxform" id="contactform" name="contactform">
<fieldset class="cform">
<div><label for="name" class="overlabel">Name *</label> <input type="text" name="name" id="name" class="box"></div>
<div><label for="email" class="overlabel">Email *</label> <input type="text" name="email" id="email" class="box"></div>
<div><label for="subject" class="overlabel">Subject *</label> <input type="text" name="subject" id="subject" class="box"></div>
<div><label for="message" class="overlabel">Message *</label>
<textarea name="message" id="message" cols="58" rows="10" class="box">
</textarea></div>
<div><input type="submit" name="Submit" value="Submit"></div>
</fieldset>
</form>

send-contact.php:
PHP:
<?php
$subject = $_POST['subject'];
$message = $_POST['message'];
$mail_from = $_POST['email'];
$header = "from: $_POST[name] <$mail_from>";
$to = 'info@vpspw.com';
$send_contact = mail($to,$subject,$message,$header);
if($send_contact){
echo "We've received your contact information";
}
else {
echo "ERROR";
}
?>
 
Last edited:
Thanks but, I don't want to change the form. I already have a really cool contact form located at http://vpspw.com/contact.html and I really don't want to use a regular contact form.

I just want to get the contact form I have, working. So, I need the contact form coded and a contact-form.php file created.

Thanks so much for your help thus far!
 
I can give you either one of those. I can give you a small reseller (maybe 4GB/50GB) for free as long as you need it, or I can give you a bigger reseller (10GB/100GB) free for 6 months or so. That should give you time to get a few clients paying so that they cover the cost.

It's up to you! Just let me know which you prefer and I will set it up for you.

Thanks again!
 
No problem! I think we better discuss this in PM :) I'll prefer the small reseller, because I don't like to hunt for clients :)

Try this code to see if it's working, will look better (styling the Submit button with your site style)
added the id and class to <input type="submit" name="Submit" id="formsend" class="smbutton" value="Submit">
I think this must work, but if not, you can just replace it with the code from previous post.

<form action="send-contact.php" method="post" class="cmxform" id="contactform" name="contactform">
<fieldset class="cform">
<div><label for="name" class="overlabel">Name *</label> <input type="text" name="name" id="name" class="box"></div>
<div><label for="email" class="overlabel">Email *</label> <input type="text" name="email" id="email" class="box"></div>
<div><label for="subject" class="overlabel">Subject *</label> <input type="text" name="subject" id="subject" class="box"></div>
<div><label for="message" class="overlabel">Message *</label>
<textarea name="message" id="message" cols="58" rows="10" class="box">
</textarea></div>
<div><input type="submit" name="Submit" id="formsend" class="smbutton" value="Submit"></div>
</fieldset>
</form>
 
Last edited:
Back
Top