Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Add Other form info in 'Contact Us'


johnnymke

Recommended Posts

Im trying to add additional form data in the contact us page. I'm able to copy the entries and post variables for 'name' as 'phone' and the contact page works, however the email doesnt show up with the phone number. Any ideas on getting this to work? Thanks!

 

  $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']);
   $phone = tep_db_prepare_input($HTTP_POST_VARS['phone']);
   $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, $phone);

     tep_redirect(tep_href_link(FILENAME_CONTACT_US, 'action=success'));
   } else {
     $error = true;

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

Link to comment
Share on other sites

I see you added the $phone variable to the end of the tep_mail() function call.

 

This will not work, as the tep_mail() function is defined with the following 6 parameters:

 

function tep_mail($to_name, $to_email_address, $email_subject, $email_text, $from_email_name, $from_email_address)

 

(the function is defined in includes/functions/general.php)

 

There is no 7th parameter defined to pass the phone variable to. The simplest way to pass this extra information along is to append it to the $enquiry variable like this:

 

    $name = tep_db_prepare_input($HTTP_POST_VARS['name']);
   $email_address = tep_db_prepare_input($HTTP_POST_VARS['email']);
   $phone = tep_db_prepare_input($HTTP_POST_VARS['phone']);
   $enquiry = tep_db_prepare_input($HTTP_POST_VARS['enquiry']);
   $enquiry .= "\n\n" . 'Telephone Number: ' . $phone

 

(the last line adds it to the bottom of the enquiry message)

 

Hope that helps!

:heart:, osCommerce

Link to comment
Share on other sites

Hi there!

 

I added the code and get this error.

Parse error: parse error, unexpected T_IF in /home/partyple/public_html/onlineshop/client_info.php on line 26

 

Any ideas please.

Link to comment
Share on other sites

By the way, here is the code line 19 - 27

 

 $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']);
   $phone = tep_db_prepare_input($HTTP_POST_VARS['telephone']);
  $enquiry = tep_db_prepare_input($HTTP_POST_VARS['enquiry']);
  $enquiry .= "\n\n" . 'Telephone Number: ' . $telephone
 if (tep_validate_email($email_address)) {
     tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, EMAIL_SUBJECT, $enquiry, $name, $email_address);

 

If anyone can see the erro, please let me know.

Many thanks in advance.

Link to comment
Share on other sites

Thanks for the reply!

 

Yeah I get a parse error as well , heres the fix...add a semi colon...

 

$enquiry .= "\n\n" . 'Telephone Number: ' . $phone;

 

 

Tested, worked, HPdL is my hero....

 

 

:D

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...