Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Need a little bit of help with code


longhorn1999

Recommended Posts

Posted

Hi everyone,

 

I have my form at includes/boxes/visitoremail.php to collect email addresses in my left column.

 

I'd like to move it to the footer, but I can't quite figure out how to get the syntax right.

 

includes/boxes/visitoremail.php:

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

 new infoBoxHeading($info_box_contents, false, false);

 $info_box_contents = array();
 $info_box_contents[] = array('form' => tep_draw_form('email', tep_href_link(FILENAME_VISITOR_EMAIL, 'action=process')),
                              'align' => 'center',
                              'text' => tep_draw_input_field('to_email_address', '', 'size="10"', 'align="left"') . ' ' . tep_image_submit('button_visitor_email.gif', BOX_HEADING_VISITOR_EMAIL, 'align="top"')) ;

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

 

I have a search form in my header:

<?php echo tep_draw_form('quick_find', tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', $request_type, false), 'get') . BOX_HEADING_SEARCH . tep_draw_input_field('keywords', '', 'size="10" maxlength="30" style="width: ' . (BOX_WIDTH-90) . 'px"') . ' ' . tep_hide_session_id() . tep_draw_hidden_field('search_in_description' , '1') . tep_image_submit('button_search.gif', BOX_HEADING_SEARCH, 'align="top"') . '</form>';?>  

 

And so I was hoping to copy that format, and here's my best guess:

<?php echo tep_draw_form('email', tep_href_link(FILENAME_VISITOR_EMAIL, 'action=process')) .  BOX_HEADING_VISITOR_EMAIL . tep_draw_input_field('to_email_address', '', 'size="10"', 'align="left"') . ' ' . tep_image_submit('button_visitor_email.gif', BOX_HEADING_VISITOR_EMAIL, 'align="top"')) . '</form>';?>

 

Unfortunately I get the standard PHP Parse error: syntax error, unexpected ')', expecting ',' or ';' in .../includes/footer.php on line 63.

 

Any ideas where I might've messed up?

 

Thanks,

 

Nick

Posted

Hi everyone,

 

I have my form at includes/boxes/visitoremail.php to collect email addresses in my left column.

 

I'd like to move it to the footer, but I can't quite figure out how to get the syntax right.

 

includes/boxes/visitoremail.php:

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

 new infoBoxHeading($info_box_contents, false, false);

 $info_box_contents = array();
 $info_box_contents[] = array('form' => tep_draw_form('email', tep_href_link(FILENAME_VISITOR_EMAIL, 'action=process')),
                              'align' => 'center',
                              'text' => tep_draw_input_field('to_email_address', '', 'size="10"', 'align="left"') . ' ' . tep_image_submit('button_visitor_email.gif', BOX_HEADING_VISITOR_EMAIL, 'align="top"')) ;

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

 

I have a search form in my header:

<?php echo tep_draw_form('quick_find', tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', $request_type, false), 'get') . BOX_HEADING_SEARCH . tep_draw_input_field('keywords', '', 'size="10" maxlength="30" style="width: ' . (BOX_WIDTH-90) . 'px"') . ' ' . tep_hide_session_id() . tep_draw_hidden_field('search_in_description' , '1') . tep_image_submit('button_search.gif', BOX_HEADING_SEARCH, 'align="top"') . '</form>';?>  

 

And so I was hoping to copy that format, and here's my best guess:

<?php echo tep_draw_form('email', tep_href_link(FILENAME_VISITOR_EMAIL, 'action=process')) .  BOX_HEADING_VISITOR_EMAIL . tep_draw_input_field('to_email_address', '', 'size="10"', 'align="left"') . ' ' . tep_image_submit('button_visitor_email.gif', BOX_HEADING_VISITOR_EMAIL, 'align="top"')) . '</form>';?>

 

Unfortunately I get the standard PHP Parse error: syntax error, unexpected ')', expecting ',' or ';' in .../includes/footer.php on line 63.

 

Any ideas where I might've messed up?

 

Thanks,

 

Nick

 

You have one too many brackets, hence the unexpected ')' error. I think you can try dropping the last closing bracket, just before the </form> tag.

Posted

This is an unstyled table with the form you should be able to put about anywhere:

<table><tr><td>
<?php 
echo tep_draw_form('email', tep_href_link(FILENAME_VISITOR_EMAIL, 'action=process'));
echo tep_draw_input_field('to_email_address', 'visitor email', 'size="10"', 'align="left"') . ' ' . tep_image_submit('button_visitor_email.gif', BOX_HEADING_VISITOR_EMAIL, 'align="top"') ;
?>
</form>
</td></tr></table>

Oscommerce site:

 

 

OSC to CSS, http://addons.oscommerce.com/info/7263 -Mail Manager, http://addons.oscommerce.com/info/8120

Posted

Hey guys,

 

Thanks for the help.

 

Unfortunately with both examples of code I get a new error, the dreaded PHP Parse error: syntax error, unexpected T_STRING.

 

Ashley, you were right that there was an extra closing bracket, though there's still something else wrong. George, the unexpected T_STRING is in the 3rd line of the code you posted.

 

It appears to be some issue with the apostrophes. If I put a \ before them, the error goes away but the form doesn't show up.

Posted

Actually it was a typo on my end...and I was trying to put the form in the <body> of the page instead of the footer.

 

Everything works fine now, thanks again for the help.

Archived

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

×
×
  • Create New...