Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Contact Us Email Only Sending Comment Field


kylel

Recommended Posts

(Improperly posted this on the 3.x forum)

 

Hello everyone,

 

I am running OSC 2.3.1. I recently added two additional fields to my contact form (address & phone number). Now, when I receive the enquiry e-mail, it will only show the comments.

 

Below is my code. Does anyone see anything that I missed? I really appreciate the help!

 

<?php
/*
 $Id$

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2010 osCommerce

 Released under the GNU General Public License
*/

 require('includes/application_top.php');

 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CONTACT_US);

 if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'send') && isset($HTTP_POST_VARS['formid']) && ($HTTP_POST_VARS['formid'] == $sessiontoken)) {
   $error = false;

   $name = tep_db_prepare_input($HTTP_POST_VARS['name']);
   $email_address = tep_db_prepare_input($HTTP_POST_VARS['email']);
       $email_homeaddress = tep_db_prepare_input($HTTP_POST_VARS['homeaddress']);
       $email_phone = tep_db_prepare_input($HTTP_POST_VARS['phone']);
   $enquiry = tep_db_prepare_input($HTTP_POST_VARS['enquiry']);

   if (!tep_validate_email($email_address)) {
     $error = true;

     $messageStack->add('contact', ENTRY_EMAIL_ADDRESS_CHECK_ERROR);
   }

   $actionRecorder = new actionRecorder('ar_contact_us', (tep_session_is_registered('customer_id') ? $customer_id : null), $name);
   if (!$actionRecorder->canPerform()) {
     $error = true;

     $actionRecorder->record(false);

     $messageStack->add('contact', sprintf(ERROR_ACTION_RECORDER, (defined('MODULE_ACTION_RECORDER_CONTACT_US_EMAIL_MINUTES') ? (int)MODULE_ACTION_RECORDER_CONTACT_US_EMAIL_MINUTES : 15)));
   }

   if ($error == false) {
     tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, EMAIL_SUBJECT, $enquiry, $name, $email_address);

     $actionRecorder->record();

     tep_redirect(tep_href_link(FILENAME_CONTACT_US, 'action=success'));
   }
 }

 $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_CONTACT_US));

 require(DIR_WS_INCLUDES . 'template_top.php');
?>

<h1><?php echo HEADING_TITLE; ?></h1>

<?php
 if ($messageStack->size('contact') > 0) {
   echo $messageStack->output('contact');
 }

 if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'success')) {
?>

<div class="contentContainer">
 <div class="contentText">
   <?php echo TEXT_SUCCESS; ?>
 </div>

<!-- <div style="float: right;">
   <?php echo tep_draw_button(IMAGE_BUTTON_CONTINUE, 'triangle-1-e', tep_href_link(FILENAME_DEFAULT)); ?>
 </div>
 -->
</div>

<?php
 } else {
?>

<?php echo tep_draw_form('contact_us', tep_href_link(FILENAME_CONTACT_US, 'action=send'), 'post', '', true); ?>

<div class="contentContainer">
 <div class="contentText">
   <table border="0" width="100%" cellspacing="0" cellpadding="2">
     <tr>
       <td class="fieldKey"><?php echo ENTRY_NAME; ?></td>
       <td class="fieldValue"><?php echo tep_draw_input_field('name'); ?></td>
     </tr>
     <tr>
       <td class="fieldKey"><?php echo ENTRY_EMAIL; ?></td>
       <td class="fieldValue"><?php echo tep_draw_input_field('email'); ?></td>
     </tr>
     <tr>
       <td class="fieldKey"><?php echo ENTRY_ADDRESS; ?></td>
       <td class="fieldValue"><?php echo tep_draw_input_field('homeaddress'); ?></td>
     </tr>
     <tr>
       <td class="fieldKey"><?php echo ENTRY_PHONE; ?></td>
       <td class="fieldValue"><?php echo tep_draw_input_field('phone'); ?></td>
     </tr>
     <tr>
       <td class="fieldKey" valign="top"><?php echo ENTRY_ENQUIRY; ?></td>
       <td class="fieldValue"><?php echo tep_draw_textarea_field('enquiry', 'soft', 50, 15); ?></td>
     </tr>
   </table>
 </div>

 <div class="buttonSet">
   <span class="buttonAction"><?php echo tep_draw_button(IMAGE_BUTTON_CONTINUE, 'triangle-1-e', null, 'primary'); ?></span>
 </div>
</div>

</form>

<?php
 }

 require(DIR_WS_INCLUDES . 'template_bottom.php');
 require(DIR_WS_INCLUDES . 'application_bottom.php');
?>

Link to comment
Share on other sites

You read the new var's from the $_POST array but don't do anything with them afterwards.

:blink:

 

BACKUP THE FILE.

 

Then try changing this code:

 

    if ($error == false) { 
     tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, EMAIL_SUBJECT, $enquiry, $name, $email_address); 

To:

 

    if ($error == false) { 
     $enquiry = "Home Address: " . $email_homeaddress . "\nPhone: " . $email_phone . "\n" . $enquiry;
     tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, EMAIL_SUBJECT, $enquiry, $name, $email_address); 

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...