944,161 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 7373
  • PHP RSS
Mar 23rd, 2006
0

PHP with Javascript Parsing

Expand Post »
I've never had a reason to use Javascript in a php file before and I'm having trouble getting it to parse.

What could be wrong with this.

[PHP]$display .= '<td width="105" align=right class=box><input name="p1B1" id="p1B1" type="text" value="'.$price.'" onblur="this.value=eedisplayFloatNDTh(eeparseFloatTh(this.value),2);
recalc_onclick('p1B1')" tabindex="1" size="14" class=ee101 >';



//..... and the code below
[/PHP]

I'm positive its this and I'm pretty certain its the ('p1B1') but how to handle the single quotes in the brace?

[PHP]recalc_onclick('p1B1')[/PHP]

The error is, "Parse error: parse error, unexpected T_STRING"




Any suggestion would be great.

Jared
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
php4ever is offline Offline
68 posts
since Feb 2005
Mar 23rd, 2006
0

Re: PHP with Javascript Parsing

Your right, the problem is -> recalc_onclick('p1B1')

The reason is because you are using single 'quotes' as opposed to "double" to encasulate strings (which is ok). But when you say that statement with single quotes inside, it thinks your ending the string. Do this to say that you literally want single quotes and you dont want to close the string

recalc_onclick(\'p1B1\')


-Brad
Reputation Points: 14
Solved Threads: 1
Junior Poster in Training
bwest is offline Offline
57 posts
since Jul 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Switching versions of PHP
Next Thread in PHP Forum Timeline: What is the use of PHP





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC