The place to talk about things that are related to CMS Made simple, but don't fit anywhere else.
fr0z3ng33k
Forum Members
Posts: 59 Joined: Thu Mar 03, 2011 4:47 pm
Post
by fr0z3ng33k » Wed Jan 25, 2012 8:19 pm
Had a site hosted by GoDaddy and this script worked along with the html version of the site. Since I've transferred it over to CMSMS (1.10.3) it no longer works. Am I missing something in my code? Server is running PHP5.3 - Thanks for the help and I apologize for my lack of knowledge.
html site:
Code: Select all
<section id="content">
<article>
<h2>Contact <span>Form</span></h2>
<form id="contacts-form" action="contact.php" method="post">
<fieldset>
<div class="field">
<label>Name:</label>
<input type="text" value="" name="Name" />
</div>
<div class="field">
<label>E-mail:</label>
<input type="text" value="" name="E-mail" />
</div>
<div class="field">
<label>Phone:</label>
<input type="text" value="" name="Phone" />
</div>
<div class="field">
<label>Company:</label>
<input type="text" value="" name="Company" />
</div>
<div class="field">
<label>Message:</label>
<textarea></textarea>
</div>
<div><a href="thankyou.html" onclick="document.getElementById('contacts-form').submit()">Send Your Message!</a></div>
</fieldset>
</form>
</article>
</section>
</div>
</div>
</div>
</div>
PHP Script:
Code: Select all
<?php
$name = $_POST['name'];
$phone = $_POST['phone'];
$email = $_POST['email'];
$company = $_POST['company'];
$your_message = $_POST['message'];
$headers .= ‘Content-type: text/html; charset=iso-8859-1′;
$content = “<__html><head><title>Contact letter</title></head></__body><br>”;
$content .= “Name: <b>” . $name . “</b><br>”;
$content .= “Email: <b>” . $email . “</b><br>”;
$content .= “Phone: <b>” . $phone . “</b><br>”;
$content .= “Company: <b>” . $company . “</b><br><hr><br>”;
$content .= $your_message;
$content .= “<br><__body></__html>”;
$mail_to = 'info@mycompany.com';
$subject = 'Message from a site visitor '.$field_name;
mail($recipient,$subject,$content,$headers);
?>
<__html>
</__body bgcolor=”#282E2C”>
<div align=”center” style=”margin-top:60px;color:#FFFFFF;font-size:11px;font-family:Tahoma;font-weight:bold”>
Your message was sent. Thank you.
</div>
<__body>
</__html>
<__script__>resizeTo(300, 300)</__script>
scelle
Forum Members
Posts: 81 Joined: Sun Apr 24, 2011 8:14 pm
Post
by scelle » Wed Jan 25, 2012 9:26 pm
I don't know why is this script not working. I just wonder why you don't use the Form Builder module for creating forms? It's a core module (which means a great support and certain maintenance) that is widely used on CMS MS sites. And it's way, way, way simpler than this.
fr0z3ng33k
Forum Members
Posts: 59 Joined: Thu Mar 03, 2011 4:47 pm
Post
by fr0z3ng33k » Wed Jan 25, 2012 11:29 pm
I'd agree but it's what the boss wants so the boss gets it. Thanks for looking at it though!
Wishbone
Power Poster
Posts: 1368 Joined: Tue Dec 23, 2008 8:39 pm
Post
by Wishbone » Thu Jan 26, 2012 12:07 am
What happens when you submit the form?
Jos
Support Guru
Posts: 4020 Joined: Wed Sep 05, 2007 8:03 pm
Post
by Jos » Thu Jan 26, 2012 1:51 pm
fr0z3ng33k wrote: I'd agree but it's what the boss wants so the boss gets it. Thanks for looking at it though!
Does the boss wants you to use this "script" or does the boss wants a contact form on the site that works properly.
If it's the first, I think he is not that good a boss
fr0z3ng33k
Forum Members
Posts: 59 Joined: Thu Mar 03, 2011 4:47 pm
Post
by fr0z3ng33k » Thu Jan 26, 2012 2:03 pm
Wishbone wrote: What happens when you submit the form?
It takes me to the ThankYou.html page but I never receive it in my inbox.
Jos wrote: fr0z3ng33k wrote: I'd agree but it's what the boss wants so the boss gets it. Thanks for looking at it though!
Does the boss wants you to use this "script" or does the boss wants a contact form on the site that works properly.
If it's the first, I think he is not that good a boss
The boss wants me to use his script. Mainly because for this site he is using CMSMS but his other sites aren't. So he wants the same working script on everything.
Jos
Support Guru
Posts: 4020 Joined: Wed Sep 05, 2007 8:03 pm
Post
by Jos » Thu Jan 26, 2012 2:11 pm
Code: Select all
$mail_to = 'info@mycompany.com';
$subject = 'Message from a site visitor '.$field_name;
mail($recipient,$subject,$content,$headers);
$field_name is not set anywhere
$recipient is not set anywhere
fr0z3ng33k
Forum Members
Posts: 59 Joined: Thu Mar 03, 2011 4:47 pm
Post
by fr0z3ng33k » Thu Jan 26, 2012 7:52 pm
Jos wrote: Code: Select all
$mail_to = 'info@mycompany.com';
$subject = 'Message from a site visitor '.$field_name;
mail($recipient,$subject,$content,$headers);
$field_name is not set anywhere
$recipient is not set anywhere
How does this look and do I need to define name, email, etc (put it in the code for now but I can remove it).
Code: Select all
<?php
$name = $_POST['name'];
$phone = $_POST['phone'];
$email = $_POST['email'];
$company = $_POST['company'];
$your_message = $_POST['message'];
$headers .= ‘Content-type: text/html; charset=iso-8859-1′;
$content = “<__html><head><title>Contact letter</title></head></__body><br>”;
$content .= “Name: <b>” . $name . “</b><br>”;
$content .= “Email: <b>” . $email . “</b><br>”;
$content .= “Phone: <b>” . $phone . “</b><br>”;
$content .= “Company: <b>” . $company . “</b><br><hr><br>”;
$content .= $your_message;
$content .= “<br><__body></__html>”;
$mail_to = 'info@mycompany.com';
$subject = 'Message from a site visitor ';
mail($name,$phone,$email,$company,$your_message,$subject,$content,$headers);
?>
<__html>
</__body bgcolor=”#282E2C”>
<div align=”center” style=”margin-top:60px;color:#FFFFFF;font-size:11px;font-family:Tahoma;font-weight:bold”>
Your message was sent. Thank you.
</div>
<__body>
</__html>
<__script__>resizeTo(300, 300)</__script>
fr0z3ng33k
Forum Members
Posts: 59 Joined: Thu Mar 03, 2011 4:47 pm
Post
by fr0z3ng33k » Fri Jan 27, 2012 2:25 pm
Jos wrote:
The real advise is still: use FormBuilder and you'll have your form running in minutes.
If I use that will it work on sites not running CMSMS? Boss wants consistency.
scelle
Forum Members
Posts: 81 Joined: Sun Apr 24, 2011 8:14 pm
Post
by scelle » Fri Jan 27, 2012 2:39 pm
Sure it will! You can set field ids, names etc... And you can create a custom template for the sent message. Try it, it's a great module!
Even better, show it to your boss, he'll love you for making his life A LOT easier!
Wishbone
Power Poster
Posts: 1368 Joined: Tue Dec 23, 2008 8:39 pm
Post
by Wishbone » Fri Jan 27, 2012 4:37 pm
If some of your sites are not using CMSMS, there's not much consistency anyways. Use that script on non-CMSMS sites. Use what's best for CMSMS (FormBuilder) on CMSMS sites.
Jos
Support Guru
Posts: 4020 Joined: Wed Sep 05, 2007 8:03 pm
Post
by Jos » Fri Jan 27, 2012 5:23 pm
fr0z3ng33k wrote: Boss wants consistency.
I guess boss only cares about the email that is generated. You can make that look exactly the same as your other sites
fr0z3ng33k
Forum Members
Posts: 59 Joined: Thu Mar 03, 2011 4:47 pm
Post
by fr0z3ng33k » Fri Jan 27, 2012 8:55 pm
Jos wrote: fr0z3ng33k wrote: Boss wants consistency.
I guess boss only cares about the email that is generated. You can make that look exactly the same as your other sites
good to hear thanks all!