whenever i put this code theyre will be an Error stating that there is unexpected ''"" Please help

<input type="button" value="Add to Cart" onclick="addtocart(<?=$row['serial']?>)" />

Recommended Answers

All 3 Replies

Hi
I think you should change the value to something like "Addtocart",there should be no spaces !!

Member Avatar for diafol

Looks ok to me. Try:

onclick="addtocart(<?php echo $row['serial'];?>)"

Perhaps your server doesn't support short tags.
Try taking out attributes one at a time from the input tag to see which is the offending one. But as I said, I can't see an obvious issue here. Is this a php error? If so, it may be upstream from here.

Mabye $row['serial'] contains some kind of apostrophe that is not allowed in that particular spot?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.