Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Problem with PHP code


Chrissie

Recommended Posts

I have this (I thought) simple code for a mouseover button but I get a T-String error.

 

Could some clever person please correct this for me? I would be so grateful!

 

<td align="right"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('<img ID=mobutton001 src="images/button_continue.jpg" width=100 height=20 onmouseover='document.getElementById("mobutton001").src = "images/button_continue_on.jpg"' onmouseout='document.getElementById("mobutton001").src = "images/button_continue.jpg"'  border='0' />', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>

 

chrissie x

Link to comment
Share on other sites

I would say that the issue is being caused by the single quote encountered around this bit of code:

tep_image_button('<img ID=mobutton001 ...

I think it is interpreting '<img ID ... as part of the string, rather than the first argument of the tep_image_button function.

 

Perhaps try assigning that first argument into a variable then passing that variable into the function. For example:

myVar = '<img ID=mobutton001 src="images/button_continue.jpg" width=100 height=20 onmouseover='document.getElementById("mobutton001").src = "images/button_continue_on.jpg"' onmouseout='document.getElementById("mobutton001").src = "images/button_continue.jpg"'  border='0' />'

tep_image_button(myVar, IMAGE_BUTTON_CONTINUE)

Link to comment
Share on other sites

Many thanks, Steve! I didn't quite fix it using your changed code but you certainly pointed me in the right direction. There seemed to be some superfluos php code which was being interpreted wrongly. I stripped this out and got things working. Here is the code that works for anyone interested.

 

<td align="right"><?php echo '<a href="' . tep_href_link (FILENAME_DEFAULT) . '">' ?>
<img ID=mobutton001 src="images/button_continue.jpg" width=100 height=20 onmouseover='document.getElementById("mobutton001").src = "images/button_continue_on.jpg"' onmouseout='document.getElementById("mobutton001").src = "images/button_continue.jpg"' border='0'></a></td>

 

 

Once again, many thanks for your help on a sticky problem!

 

Chrissie x

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...