Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Form Problems


Guest

Recommended Posts

Im trying to set up a form but for some reason all I'm recieving is an email with the corect subject line but the body of the email only contains the inputed email address of the sender and not the other fields I added. could someone have a look at this code and let me know where I'm going wrong.

 

Thank you.

 

<?php
/*
 $Id: cat_request.php,v 1.0 01/10/2004 Fred Doherty $

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

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 require('includes/application_top.php');

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

 $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']);
   $addressline1 = tep_db_prepare_input($HTTP_POST_VARS['addressline1']);
$addressline2 = tep_db_prepare_input($HTTP_POST_VARS['addressline2']);
$town = tep_db_prepare_input($HTTP_POST_VARS['town']);
$county = tep_db_prepare_input($HTTP_POST_VARS['county']);
$country = tep_db_prepare_input($HTTP_POST_VARS['country']);
$postcode = tep_db_prepare_input($HTTP_POST_VARS['postcode']);

   if (tep_validate_email($email_address)) {
     tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, EMAIL_SUBJECT, $email_address, $name, $addressline1, $addressline2, $town, $county, $country, $postcode);

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

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

 $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_CAT_REQUEST));
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="3" cellpadding="3">
 <tr>
   <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
   </table></td>
<!-- body_text //-->
   <td width="100%" valign="top"><?php echo tep_draw_form('cat_request', tep_href_link(FILENAME_CAT_REQUEST, 'action=send')); ?><table border="0" width="100%" cellspacing="0" cellpadding="0">
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
         <tr>
           <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
           <td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_cat_request.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
         </tr>
       </table></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
<?php
 if ($messageStack->size('cat_request') > 0) {
?>
     <tr>
       <td><?php echo $messageStack->output('cat_request'); ?></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
<?php
 }

 if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'success')) {
?>
     <tr>
       <td class="main" align="center"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_man_on_board.gif', HEADING_TITLE, '0', '0', 'align="left"') . TEXT_SUCCESS; ?></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
     <tr>
       <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
         <tr class="infoBoxContents">
           <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
             <tr>
               <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
               <td align="right"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>
               <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
             </tr>
           </table></td>
         </tr>
       </table></td>
     </tr>
<?php
 } else {
?>
     <tr>
       <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
         <tr class="infoBoxContents">
           <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
             <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_EMAIL; ?></td>
             </tr>
             <tr>
               <td class="main"><?php echo tep_draw_input_field('email'); ?></td>
             </tr>
             <tr>
               <td class="main"><?php echo ENTRY_ADDRESSLINE1; ?></td>
             </tr>
             <tr>
               <td class="main"><?php echo tep_draw_input_field('addressline1'); ?></td>
             </tr>
    <tr>
               <td class="main"><?php echo ENTRY_ADDRESSLINE2; ?></td>
             </tr>
             <tr>
               <td class="main"><?php echo tep_draw_input_field('addressline2'); ?></td>
             </tr>
    <tr>
               <td class="main"><?php echo ENTRY_TOWN; ?></td>
             </tr>
             <tr>
               <td class="main"><?php echo tep_draw_input_field('town'); ?></td>
             </tr>
    <tr>
               <td class="main"><?php echo ENTRY_COUNTY; ?></td>
             </tr>
             <tr>
               <td class="main"><?php echo tep_draw_input_field('county'); ?></td>
             </tr>
    <tr>
               <td class="main"><?php echo ENTRY_COUNTRY; ?></td>
             </tr>
             <tr>
               <td class="main"><?php echo tep_draw_input_field('country'); ?></td>
             </tr>
    <tr>
               <td class="main"><?php echo ENTRY_POSTCODE; ?></td>
             </tr>
             <tr>
               <td class="main"><?php echo tep_draw_input_field('postcode'); ?></td>
             </tr>
           </table></td>
         </tr>
       </table></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
     <tr>
       <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
         <tr class="infoBoxContents">
           <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
             <tr>
               <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
               <td align="right"><?php echo tep_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE); ?></td>
               <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
             </tr>
           </table></td>
         </tr>
       </table></td>
     </tr>
<?php
 }
?>
   </table></form></td>
<!-- body_text_eof //-->
   <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- right_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
<!-- right_navigation_eof //-->
   </table></td>
 </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

 

Any help getting this form to work would be much apreciated. If you have help making it look more atractive then that would be FANTASTIC :thumbsup:

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...