Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Adding Fields to Contact_us


Guest

Recommended Posts

Hey,

 

I added some new fields to the contact_us page such as telephone and company name, but for some reason they are not appearing in the email sent back to us when someone submits a contact us request.

 

Any help??

Link to comment
Share on other sites

Around line 21 modify like this

 

$enquiry = tep_db_prepare_input($HTTP_POST_VARS['companyname']) . "\n\n";

$enquiry .= tep_db_prepare_input($HTTP_POST_VARS['telephone']) . "\n\n";

$enquiry .= tep_db_prepare_input($HTTP_POST_VARS['enquiry']);

 

That will add the extra post vars to the $enquiry before sending the mail.

 

Also you should put in the XSS security fix.

 

http://www.oscommerce.com/community/contributions,2976

Link to comment
Share on other sites

Around line 21 modify like this

 

$enquiry  = tep_db_prepare_input($HTTP_POST_VARS['companyname']) . "\n\n";

$enquiry .= tep_db_prepare_input($HTTP_POST_VARS['telephone']) . "\n\n";

$enquiry .= tep_db_prepare_input($HTTP_POST_VARS['enquiry']);

 

That will add the extra post vars to the $enquiry before sending the mail.

 

Also you should put in the XSS security fix.

 

http://www.oscommerce.com/community/contributions,2976

 

 

Hello, Thank you for answering this for me. I did what you suggested and it appears the telephone number and company name are not posting to the email message.

 

Here is what I have, perhaps you see something I did wrong.

 

MUCH APPRECIATED.

 

$name = tep_db_prepare_input($HTTP_POST_VARS['name']);
   $companyname = tep_db_prepare_input($HTTP_POST_VARS['companyname']);
   $companytelephone = tep_db_prepare_input($HTTP_POST_VARS['companytelephone']);
   $email_address = tep_db_prepare_input($HTTP_POST_VARS['email']);
   $enquiry = tep_db_prepare_input($HTTP_POST_VARS['enquiry']);

   if (tep_validate_email($email_address)) {
     tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, EMAIL_SUBJECT, $enquiry, $name, $email_address);

 

 <tr>
               <td class="main"><?php echo ENTRY_NAME; ?></td>
             </tr>
             <tr>
               <td class="main"><?php echo tep_draw_input_field('name'); ?></td>
             </tr>
             <tr>
               <td class="main"><?php echo ENTRY_COMPANY; ?></td>
             </tr>
             <tr>
               <td class="main"><?php echo tep_draw_input_field('companyname'); ?></td>
             </tr>
                <tr>
               <td class="main"><?php echo ENTRY_TELEPHONE; ?></td>
             </tr>
             <tr>
               <td class="main"><?php echo tep_draw_input_field('companytelephone'); ?></td>
             </tr>
             <tr>
               <td class="main"><?php echo ENTRY_EMAIL; ?></td>
             </tr>
             <tr>
               <td class="main"><?php echo tep_draw_input_field('email'); ?></td>
             </tr>
             <tr>
               <td class="main"><?php echo ENTRY_ENQUIRY; ?></td>
             </tr>
             <tr>
               <td><?php echo tep_draw_textarea_field('enquiry', 'soft', 50, 15); ?></td>
             </tr>

Link to comment
Share on other sites

Change your code as he suggested ie:

$name = tep_db_prepare_input($HTTP_POST_VARS['name']);
  $companyname = tep_db_prepare_input($HTTP_POST_VARS['companyname']);
  $companytelephone = tep_db_prepare_input($HTTP_POST_VARS['companytelephone']);
  $email_address = tep_db_prepare_input($HTTP_POST_VARS['email']);
$enquiry  = tep_db_prepare_input($HTTP_POST_VARS['companyname']) . "\n\n";
$enquiry .= tep_db_prepare_input($HTTP_POST_VARS['telephone']) . "\n\n";
$enquiry .= tep_db_prepare_input($HTTP_POST_VARS['enquiry']);


  if (tep_validate_email($email_address)) {
    tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, EMAIL_SUBJECT, $enquiry, $name, $email_address);

Link to comment
Share on other sites

  • 6 months later...

On our "Contact Us" page, the only field that gets sent to our email is the "Comments" section. We would like the Name and Email Address to come along in the emails also. I have tried copying and pasting parts of the code you listed but once I do that, the page doesn't come up at all so I am doing something wrong, not sure what! Please help, we have received 10 enquiries today and have no idea how to reply to them!

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...