Joomla contact form...... Why is this killing me

  • Zealous
  • Guru
  • Guru
  • User avatar
  • Posts: 1244
  • Loc: Sydney

Post 3+ Months Ago

I have no idea why but this is starting to kill me with such a simple task. In Wordpress i would of had it done in 5 minutes but this Joomla is starting to annoy me.

i have been going through the extensions for this and some are paid and some are free but for now i just wanted something that looks a little cleaner then the default one that joomla has. after working with joomla for 2 weeks now, i think it should burn in hell. Wordpress is no where near this bad to construct, i have no idea why some people swear by it.

anyway my question is, what is a simple form i can install that works and won't screw me around.
  • Zealous
  • Guru
  • Guru
  • User avatar
  • Posts: 1244
  • Loc: Sydney

Post 3+ Months Ago

does not matter, just made a custom HTML form
  • Poly
  • Guru
  • Guru
  • User avatar
  • Posts: 1091
  • Loc: Same place you left me.

Post 3+ Months Ago

Hi Zealous!

It would be great if you would post the solution as it would assist others with the frustration you were experiencing.
  • Zealous
  • Guru
  • Guru
  • User avatar
  • Posts: 1244
  • Loc: Sydney

Post 3+ Months Ago

Sure

-Create a article named contact us
-Create a menu item contact us and in Required Settings hit select and select your contact us page.

Now that your page is setup i went to gogle and found a base html contact form with php processing and added the html form and uploaded the php file to the root of the web site, in the html form you need to direct the src to the php file in the root so when the form is processed it will find the php file and execute what it needs to.

Now i am sure most of you have seen the code i am about to post everywhere as it is basic run of the mill form but it works so why change it for basic stuff.

Under the HTML form, add company details and there is a section for google maps where you add the address to where i have made a note and bingo google maps. Just fix up the links and ready to go

html
Code: [ Select ]
<table border="0" cellspacing="0" cellpadding="0" align="center">
<tbody>
<tr>
<td width="1%"> </td>
<td width="64%"> </td>
<td width="13%"> </td>
<td width="22%"> </td>
</tr>
<tr>
<td> </td>
<td>
<div align="center"><form action="http://www.site.com/phpmail.php" method="post" name="htmlform">
<table style="width: 450px;">
<tbody>
<tr>
<td valign="top" width="185"><label for="first_name">First Name *</label></td>
<td valign="top" width="212"><input type="text" name="first_name" size="30" maxlength="50" /></td>
</tr>
<tr>
<td valign="top"><label for="last_name">Last Name *</label></td>
<td valign="top"><input type="text" name="last_name" size="30" maxlength="50" /></td>
</tr>
<tr>
<td valign="top"><label for="email">Email Address *</label></td>
<td valign="top"><input type="text" name="email" size="30" maxlength="80" /></td>
</tr>
<tr>
<td valign="top"><label for="telephone">Telephone Number</label></td>
<td valign="top"><input type="text" name="telephone" size="30" maxlength="30" /></td>
</tr>
<tr>
<td valign="top"><label for="comments">Comments *</label></td>
<td valign="top"><textarea name="comments" rows="6" cols="25"></textarea></td>
</tr>
<tr>
<td style="text-align: center;" colspan="2"><input type="submit" value="Submit" /></td>
</tr>
</tbody>
</table>
</form></div>
</td>
<td colspan="2">
<div align="center">{google_map}(put address here){/google_map}</div>
</td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td>
<div align="center">
<h4>Office Hours</h4>
</div>
</td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td>
<div align="center">
<h4>7am till 5pm Monday To Friday</h4>
</div>
</td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td>
<div align="center">
<h4>Closed on Weekends</h4>
</div>
</td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td>
<h4> </h4>
</td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td>
<div align="center">
<h4>Sales: (02) 0000 0000</h4>
</div>
</td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td>
<div align="center">
<h4>Fax: (02) 0000 0000</h4>
</div>
</td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td>
<div align="center">
<h4>Address: somewhere</h4>
</div>
</td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td>
<h4> </h4>
</td>
<td> </td>
<td> </td>
</tr>
</tbody>
</table>
  1. <table border="0" cellspacing="0" cellpadding="0" align="center">
  2. <tbody>
  3. <tr>
  4. <td width="1%"> </td>
  5. <td width="64%"> </td>
  6. <td width="13%"> </td>
  7. <td width="22%"> </td>
  8. </tr>
  9. <tr>
  10. <td> </td>
  11. <td>
  12. <div align="center"><form action="http://www.site.com/phpmail.php" method="post" name="htmlform">
  13. <table style="width: 450px;">
  14. <tbody>
  15. <tr>
  16. <td valign="top" width="185"><label for="first_name">First Name *</label></td>
  17. <td valign="top" width="212"><input type="text" name="first_name" size="30" maxlength="50" /></td>
  18. </tr>
  19. <tr>
  20. <td valign="top"><label for="last_name">Last Name *</label></td>
  21. <td valign="top"><input type="text" name="last_name" size="30" maxlength="50" /></td>
  22. </tr>
  23. <tr>
  24. <td valign="top"><label for="email">Email Address *</label></td>
  25. <td valign="top"><input type="text" name="email" size="30" maxlength="80" /></td>
  26. </tr>
  27. <tr>
  28. <td valign="top"><label for="telephone">Telephone Number</label></td>
  29. <td valign="top"><input type="text" name="telephone" size="30" maxlength="30" /></td>
  30. </tr>
  31. <tr>
  32. <td valign="top"><label for="comments">Comments *</label></td>
  33. <td valign="top"><textarea name="comments" rows="6" cols="25"></textarea></td>
  34. </tr>
  35. <tr>
  36. <td style="text-align: center;" colspan="2"><input type="submit" value="Submit" /></td>
  37. </tr>
  38. </tbody>
  39. </table>
  40. </form></div>
  41. </td>
  42. <td colspan="2">
  43. <div align="center">{google_map}(put address here){/google_map}</div>
  44. </td>
  45. </tr>
  46. <tr>
  47. <td> </td>
  48. <td> </td>
  49. <td> </td>
  50. <td> </td>
  51. </tr>
  52. <tr>
  53. <td> </td>
  54. <td>
  55. <div align="center">
  56. <h4>Office Hours</h4>
  57. </div>
  58. </td>
  59. <td> </td>
  60. <td> </td>
  61. </tr>
  62. <tr>
  63. <td> </td>
  64. <td>
  65. <div align="center">
  66. <h4>7am till 5pm Monday To Friday</h4>
  67. </div>
  68. </td>
  69. <td> </td>
  70. <td> </td>
  71. </tr>
  72. <tr>
  73. <td> </td>
  74. <td>
  75. <div align="center">
  76. <h4>Closed on Weekends</h4>
  77. </div>
  78. </td>
  79. <td> </td>
  80. <td> </td>
  81. </tr>
  82. <tr>
  83. <td> </td>
  84. <td>
  85. <h4> </h4>
  86. </td>
  87. <td> </td>
  88. <td> </td>
  89. </tr>
  90. <tr>
  91. <td> </td>
  92. <td>
  93. <div align="center">
  94. <h4>Sales: (02) 0000 0000</h4>
  95. </div>
  96. </td>
  97. <td> </td>
  98. <td> </td>
  99. </tr>
  100. <tr>
  101. <td> </td>
  102. <td>
  103. <div align="center">
  104. <h4>Fax: (02) 0000 0000</h4>
  105. </div>
  106. </td>
  107. <td> </td>
  108. <td> </td>
  109. </tr>
  110. <tr>
  111. <td> </td>
  112. <td> </td>
  113. <td> </td>
  114. <td> </td>
  115. </tr>
  116. <tr>
  117. <td> </td>
  118. <td>
  119. <div align="center">
  120. <h4>Address: somewhere</h4>
  121. </div>
  122. </td>
  123. <td> </td>
  124. <td> </td>
  125. </tr>
  126. <tr>
  127. <td> </td>
  128. <td>
  129. <h4> </h4>
  130. </td>
  131. <td> </td>
  132. <td> </td>
  133. </tr>
  134. </tbody>
  135. </table>

PHP
Code: [ Select ]
<?php
if(isset($_POST['email'])) {
  
  // CHANGE THE TWO LINES BELOW
  $email_to = "sales@site.com";
  
  $email_subject = "site | Contact form";
  
  
  function died($error) {
    // your error code can go here
    echo "We are very sorry, but there were error(s) found with the form you submitted. ";
    echo "These errors appear below.<br /><br />";
    echo $error."<br /><br />";
    echo "Please go back and fix these errors.<br /><br />";
    die();
  }
  
  // validation expected data exists
  if(!isset($_POST['first_name']) ||
    !isset($_POST['last_name']) ||
    !isset($_POST['email']) ||
    !isset($_POST['telephone']) ||
    !isset($_POST['comments'])) {
    died('We are sorry, but there appears to be a problem with the form you submitted.');   
  }
  
  $first_name = $_POST['first_name']; // required
  $last_name = $_POST['last_name']; // required
  $email_from = $_POST['email']; // required
  $telephone = $_POST['telephone']; // not required
  $comments = $_POST['comments']; // required
  
  $error_message = "";
  $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
 if(!preg_match($email_exp,$email_from)) {
  $error_message .= 'The Email Address you entered does not appear to be valid.<br />';
 }
  $string_exp = "/^[A-Za-z .'-]+$/";
 if(!preg_match($string_exp,$first_name)) {
  $error_message .= 'The First Name you entered does not appear to be valid.<br />';
 }
 if(!preg_match($string_exp,$last_name)) {
  $error_message .= 'The Last Name you entered does not appear to be valid.<br />';
 }
 if(strlen($comments) < 2) {
  $error_message .= 'The Comments you entered do not appear to be valid.<br />';
 }
 if(strlen($error_message) > 0) {
  died($error_message);
 }
  $email_message = "Form details below.\n\n";
  
  function clean_string($string) {
   $bad = array("content-type","bcc:","to:","cc:","href");
   return str_replace($bad,"",$string);
  }
  
  $email_message .= "First Name: ".clean_string($first_name)."\n";
  $email_message .= "Last Name: ".clean_string($last_name)."\n";
  $email_message .= "Email: ".clean_string($email_from)."\n";
  $email_message .= "Telephone: ".clean_string($telephone)."\n";
  $email_message .= "Comments: ".clean_string($comments)."\n";
  
  
// create email headers
$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message, $headers);
?>


<!-- place your own success html below -->
<body bgcolor="#dcd0bb">
<div align="center"><img src="http://site.com/images/860x171_site_logo.png"</img></div>
<div align="center" >
<div align="center"><p>Thank you for contacting us. We will be in touch with you very soon. </p></div>
<div align="center"><p>If you have any questions please call us (02) 0000 0000</p>
<script type="text/javascript" align="center">
<!--
function Redirect()
{
  window.location="http://www.site.com.au";
}

document.write("You will be redirected to main page in 5 sec.");
setTimeout('Redirect()', 5000);
//-->
</script>
</div>
</body>

<?php
}
die();
?>
  1. <?php
  2. if(isset($_POST['email'])) {
  3.   
  4.   // CHANGE THE TWO LINES BELOW
  5.   $email_to = "sales@site.com";
  6.   
  7.   $email_subject = "site | Contact form";
  8.   
  9.   
  10.   function died($error) {
  11.     // your error code can go here
  12.     echo "We are very sorry, but there were error(s) found with the form you submitted. ";
  13.     echo "These errors appear below.<br /><br />";
  14.     echo $error."<br /><br />";
  15.     echo "Please go back and fix these errors.<br /><br />";
  16.     die();
  17.   }
  18.   
  19.   // validation expected data exists
  20.   if(!isset($_POST['first_name']) ||
  21.     !isset($_POST['last_name']) ||
  22.     !isset($_POST['email']) ||
  23.     !isset($_POST['telephone']) ||
  24.     !isset($_POST['comments'])) {
  25.     died('We are sorry, but there appears to be a problem with the form you submitted.');   
  26.   }
  27.   
  28.   $first_name = $_POST['first_name']; // required
  29.   $last_name = $_POST['last_name']; // required
  30.   $email_from = $_POST['email']; // required
  31.   $telephone = $_POST['telephone']; // not required
  32.   $comments = $_POST['comments']; // required
  33.   
  34.   $error_message = "";
  35.   $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
  36.  if(!preg_match($email_exp,$email_from)) {
  37.   $error_message .= 'The Email Address you entered does not appear to be valid.<br />';
  38.  }
  39.   $string_exp = "/^[A-Za-z .'-]+$/";
  40.  if(!preg_match($string_exp,$first_name)) {
  41.   $error_message .= 'The First Name you entered does not appear to be valid.<br />';
  42.  }
  43.  if(!preg_match($string_exp,$last_name)) {
  44.   $error_message .= 'The Last Name you entered does not appear to be valid.<br />';
  45.  }
  46.  if(strlen($comments) < 2) {
  47.   $error_message .= 'The Comments you entered do not appear to be valid.<br />';
  48.  }
  49.  if(strlen($error_message) > 0) {
  50.   died($error_message);
  51.  }
  52.   $email_message = "Form details below.\n\n";
  53.   
  54.   function clean_string($string) {
  55.    $bad = array("content-type","bcc:","to:","cc:","href");
  56.    return str_replace($bad,"",$string);
  57.   }
  58.   
  59.   $email_message .= "First Name: ".clean_string($first_name)."\n";
  60.   $email_message .= "Last Name: ".clean_string($last_name)."\n";
  61.   $email_message .= "Email: ".clean_string($email_from)."\n";
  62.   $email_message .= "Telephone: ".clean_string($telephone)."\n";
  63.   $email_message .= "Comments: ".clean_string($comments)."\n";
  64.   
  65.   
  66. // create email headers
  67. $headers = 'From: '.$email_from."\r\n".
  68. 'Reply-To: '.$email_from."\r\n" .
  69. 'X-Mailer: PHP/' . phpversion();
  70. @mail($email_to, $email_subject, $email_message, $headers);
  71. ?>
  72. <!-- place your own success html below -->
  73. <body bgcolor="#dcd0bb">
  74. <div align="center"><img src="http://site.com/images/860x171_site_logo.png"</img></div>
  75. <div align="center" >
  76. <div align="center"><p>Thank you for contacting us. We will be in touch with you very soon. </p></div>
  77. <div align="center"><p>If you have any questions please call us (02) 0000 0000</p>
  78. <script type="text/javascript" align="center">
  79. <!--
  80. function Redirect()
  81. {
  82.   window.location="http://www.site.com.au";
  83. }
  84. document.write("You will be redirected to main page in 5 sec.");
  85. setTimeout('Redirect()', 5000);
  86. //-->
  87. </script>
  88. </div>
  89. </body>
  90. <?php
  91. }
  92. die();
  93. ?>
  • grinch2171
  • Moderator
  • Genius
  • User avatar
  • Posts: 6810
  • Loc: Martinsburg, WV

Post 3+ Months Ago

Is there a reason you are using Joomla? This is much easier to do in Drupal.
  • Zealous
  • Guru
  • Guru
  • User avatar
  • Posts: 1244
  • Loc: Sydney

Post 3+ Months Ago

I just got hired by this company to take care of the entire web section of the company full time and build a online store as well. When i got here there was work done by a out of house web designer which i have been cleaning up his mess that he left. But instead of starting from scratch again and costing the company more money i kept what has been done and tried to fix everything using what i had.

it was a situation that called for "Challenge accepted"

So never used joomla in a day in my life nor the shopping cart software, i am figuring out how everything works. Which after 2 weeks i am getting there. But the default contact form for joomla is just really ugly to the 10th degree and extensions for joomla are absolutely a arrow to the knee stuff made by kids in pre school.

So i got to the point in this situation where i just took some basic html and php processing and slapped it in and now the boss is very happy with how it looks and works and now i just need to work in anti bot checking before i launch the web site.
  • grinch2171
  • Moderator
  • Genius
  • User avatar
  • Posts: 6810
  • Loc: Martinsburg, WV

Post 3+ Months Ago

I played with Joomla once and absolutely hated it. Been using Drupal for quite a few years now and I really like it.

Glad you are making the boss happy though, that is what is important.
  • Zimistrz
  • Newbie
  • Newbie
  • User avatar
  • Posts: 10

Post 3+ Months Ago

Zealous wrote:
I just got hired by this company to take care of the entire web section of the company full time and build a online store as well. When i got here there was work done by a out of house web designer which i have been cleaning up his mess that he left. But instead of starting from scratch again and costing the company more money i kept what has been done and tried to fix everything using what i had.

it was a situation that called for "Challenge accepted"

Such challenges tend to cost twice more at the end, and take more time than starting everything from scratch.
Done that couple times, but I always try to have on mind: those aren't my money.
There's nothing worse than fixing bugs and errors done and left by previous "expert".

Zealous wrote:
So never used joomla in a day in my life nor the shopping cart software, i am figuring out how everything works. Which after 2 weeks i am getting there. But the default contact form for joomla is just really ugly to the 10th degree and extensions for joomla are absolutely a arrow to the knee stuff made by kids in pre school.

Glad to hear that you made it.
I've touched all of the most popular CMSes, and to be honest Joomla's extensions quality is way higher than Wordpress. Of course those coming from official repository called JED. But if you say they quality of J! horrifying I won't think what would you say after trying out some of WP's plugins :roll:
Anyway, everything needs to be optimised if you're a code purist ;)
I remember a small plugin for WP which crawled dbase for links to similar articles and inserted them at the end of page's content.
Over 200 DB requests, 40MB data transferred from DB - that was a f_word nightmare :|

Zealous wrote:
So i got to the point in this situation where i just took some basic html and php processing and slapped it in and now the boss is very happy with how it looks and works and now i just need to work in anti bot checking before i launch the web site.


I use two extensions for contacting purposes: very powerful aicontactsafe, and rsform pro for a bit more fancy options (f.e. dynamic lists / form content). For a simple contact forms out of box I'd recommend Fox or Flexi contact forms. But still, everything depends on your needs.


Grinch mentioned Drupal. I wish I had enough spare time to move from J! to Drupal, but its development curve is very difficult, and takes way more time for 1 man webdevelopment army :|

ps. every webmaster tends to stick with one of top CMSes, hating other ones.

Post Information

  • Total Posts in this topic: 8 posts
  • Users browsing this forum: No registered users and 20 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.