Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

contact_us question


Recommended Posts

Hi, I have been having a problem with people not putting there correct email address into the "Contact Us" Form, making it impossible to get in contact with them.

Does anyone know what I would have to do to get their company name and phone number as part of the contact us form? Thanks in advance for any help :rolleyes:

I am kinda php no0b... here is the code from my current "Contact Us" Page, I assume that it would have to be in this section somewhere, but I am lost... 10X in advance!




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

 $error = false;
 if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'send')) {
   $name = tep_db_prepare_input($HTTP_POST_VARS['name']);
   $email_address = tep_db_prepare_input($HTTP_POST_VARS['email']);
   $enquiry = tep_db_prepare_input($HTTP_POST_VARS['enquiry']);
$sender_type = tep_db_prepare_input($HTTP_POST_VARS['sendertype']);

if (strlen($name)<3) {
 $error = true;
 $messageStack->add('contact', ENTRY_NAME_CHECK_ERROR);
   if (!tep_validate_email($email_address)) {
     $error = true;
     $messageStack->add('contact', ENTRY_EMAIL_ADDRESS_CHECK_ERROR);
if ($enquiry == '') {
 $error = true;
 $messageStack->add('contact', ENTRY_ENQUIRY_CHECK_ERROR);
if ($error == false) {
  // add IP address and preamble text to message body
  $enquiry = sprintf(EMAIL_PREAMBLE_TEXT, $sender_type) . " " . tep_get_ip_address() . "\n-----------------------\n" . $enquiry;
  // use list of contact addresses if configured
     if (defined('CONTACT_US_LIST') && (CONTACT_US_LIST !='')){
 $send_to_array=explode("," ,CONTACT_US_LIST);
 preg_match('/\<[^>]+\>/', $send_to_array[$send_to], $send_email_array);
 $send_to_email= eregi_replace (">", "", $send_email_array[0]);
 $send_to_email= eregi_replace ("<", "", $send_to_email);
 // append sender type to subject line
 tep_mail(preg_replace('/\<[^*]*/', '', $send_to_array[$send_to]), $send_to_email, $sender_type . " " . EMAIL_SUBJECT, $enquiry, $name, $email_address);
       tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, $sender_type . " " . EMAIL_SUBJECT, $enquiry, $name, $email_address);
     tep_redirect(tep_href_link(FILENAME_CONTACT_US, 'action=success'));

Link to comment
Share on other sites

The standard osCommerce 'contact us' page is not very amenable to being changed, especially so if you are trying to add some text of your own to the page. Much better to put your own 'contact us' script form in that page, with the actual executable script elsewhere, leading to a 'Thank You' page when completed.



Link to comment
Share on other sites

The Contact Us Choice contribution will fill in the customers name and email address if they are logged in. It will also diplay the name address and phone number of the store. Other capabilities are creating different departments for customer inquiries. Sample (modified) can be seen here.


Contact Us Choice





Link to comment
Share on other sites


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

  • Create New...