I'm trying to define a Google Analytic even tracker on one of my Buttons so i need to add onSubmit="_gaq.push(['_trackEvent', 'Button', 'Click', 'Compare']);" the original line is echo '<input id="in_submit" type="submit" name="submit" value="Compare >>" />'; but if i'll put it like this echo '<input onSubmit="_gaq.push(['_trackEvent', 'Button', 'Click', 'Compare']);" id="in_submit" type="submit" name="submit" value="Compare >>" />'; it will give me an error.. any idea what's breaking this line ?
you have to escape the ' inside the echo statement echo '<input onSubmit="_gaq.push([\'_trackEvent\', \'Button\', \'Click\', \'Compare\']);" id="in_submit" type="submit" name="submit" value="Compare >>" />'; PHP: