Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

tep_redirect or tep_href_link problem


NordicElf

Recommended Posts

Hi

 

I've made an infobox called book enquiry, it has a little form in it, so that my customers can enquire about books not necessarily listed on my site. I stole the form code from contact_us and used other code from manufacturer_info.php. The form works fine, it sends an email to my customer confirming their enquiry (email isn't so good but I'll sort that out later...), problem is it's supposed to return you to a new page book_enquiry.php which I based on privacy.php (has a continue button taking you back to default.php) when you get to this page it's all weird!!!! The info boxes on the right are very wide and it squashes the main text into a narrow column. There is also an error on this page message: Something about object expected http://ultra-violet.co.za/cataog/book_enqu...php?action=send -> Which is why I think it might be a problem with tep_redirect or tep_href_link???

 

Here is my entire bookenquirybox.php code

<?php
/*
 $Id: bookenquirybox.php,v 1.6 2003/02/10 22:31:00 hpdl Exp $

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

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

//from contact us, form handling I think!!!

$error = false;
 if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'send')) {
   if (tep_validate_email(trim($HTTP_POST_VARS['email']))) {
     //added by mk
     $email_text = 'Hi ' . $HTTP_POST_VARS['name'] . '\r\n<p>Thank you for your enquiry.\r\n<br>Information regarding ' . $HTTP_POST_VARS['title'] . ' by ' . $HTTP_POST_VARS['author'] . ' will be sent to you in the next day or two.\r\n<p>Kind Regards<br>Michelle Kneisel<p>Ultra Violet Book Caf?\r\n<br>Tel/Fax: 0118889093\r\n<br>Cell: 0732518773\r\n<br><a href=\"http://www.ultra-violet.co.za>www.ultra-violet.co.za</a>';

     tep_mail($HTTP_POST_VARS['name'], $HTTP_POST_VARS['email'], 'Book Enquiry', $email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

     // hoping to solve the weird front page after above form is submitted
     tep_redirect(tep_href_link(FILENAME_BOOK_ENQUIRY, ''));//took out action=success
   } else {
     $error = true;
   }
 }

?>
<!-- bookenquirybox //-->
         <tr>
           <td>
<?php
 $info_box_contents = array();
 $info_box_contents[] = array('text' => BOX_HEADING_BOOKENQUIRY);

 new infoBoxHeading($info_box_contents, false, false);

 $info_box_contents = array();
 $bookenquiry_info_string = '<table border="0" width="100%" cellspacing="0" cellpadding="0">Looking for information on a book you can\'t see here? No problem! Fill out the form and we\'ll get back to you soon.'; 

 //if customer not logged in...
 // changed tep_href_link(FILENAME_DEFAULT, 'action=send')
 $bookenquiry_info_string .= tep_draw_form('bookenquiry', tep_href_link(FILENAME_BOOK_ENQUIRY, 'action=send')) . '<table border="0" width="100%" cellspacing="0" cellpadding="2">
         <tr>
           <td class="main">Name:<br>' . tep_draw_input_field('name', ($error ? $HTTP_POST_VARS['name'] : $first_name)) . '</td>
         </tr>
         <tr>
           <td class="main">E-mail:<br>' . tep_draw_input_field('email', ($error ? $HTTP_POST_VARS['email'] : $email_address));
       //checking validity of email address
       if ($error) echo ENTRY_EMAIL_ADDRESS_CHECK_ERROR; 
$bookenquiry_info_string .= '</td>
         </tr>
         <tr>
           <td class="main">Title:<br>' . tep_draw_input_field('title', ($error ? $HTTP_POST_VARS['author'] : $title)) . '</td>
         </tr>
         <tr>
           <td class="main">Author:<br>' . tep_draw_input_field('author', ($error ? $HTTP_POST_VARS['author'] : $author)) . '</td>
         </tr>
         <tr>
           <td class="main" align="center"><br>'. tep_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</td>
         </tr>
       </table></form>';


$info_box_contents[] = array('text' => $bookenquiry_info_string);

 new infoBox($info_box_contents);
?>
           </td>
         </tr>
<!-- bookenquiry_eof //-->

 

Any ideas?

Link to comment
Share on other sites

Change:

 

(tep_href_link(FILENAME_BOOK_ENQUIRY, ''));

 

to:

 

(tep_href_link(FILENAME_BOOK_ENQUIRY));

 

Matti

Link to comment
Share on other sites

This didn't really make a difference.

 

If I type the page I'm redirected to after filling in the form directly into the browser, it's fine, layout looks fine catalog/book_enquiry.php and even if I append the ?action=send in the browser, the layout is fine. So it doesn't seem to be a problem from the url (action=send). I've also figured out what is producing the errors on page, it's my jscript... I know how to fix that.

 

The only thing I can think of is that some parameters that I don't know of are being passed to book_enquiry.php.

 

I'm going live on Tuesday and I really like this feature, it's worked so well for me on my other site. I'd hate to leave it out!!!

 

Someone please give it a bash!!!

 

www.ultra-violet.co.za/catalog

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...