Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

unterminated string literal

Posted on 2010-08-12
6
Medium Priority
?
633 Views
Last Modified: 2013-12-13
hello
i am getting an error of: unterminated string literal in a popup and cannot see where the error is. i have posted the code and would be grateful if someone could tell me how to troubleshoot this. it is only happening with 1 user as all the other users can action ok. many thanks
<td valign=\"top\"><a href=\"#\" onClick=\"PopUp('" . $action . "','winAvail','status=no,scrollbars=no,resizable=no,width=465,height=450');\">Action</a></td>

js
---------------------------------------------------

<script language="JavaScript" type="text/JavaScript"> 

function PopUp(theURL,winName,features) {
 var oWin = window.open(theURL,winName,features);
 oWin.focus();
}
</script>

action var
----------------------------------------------------------

$action = "action.php?id=$id&slot=$slot&service=$service&company=$company&user=$custname&department=$department&activity=$activity&item=$item&filebox=$filebox&date=$date&quantity=$quantity&type=$type&new=$new";

Open in new window

0
Comment
Question by:peter_coop
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
6 Comments
 
LVL 58

Expert Comment

by:cyberkiwi
ID: 33424756
You probably have single quotes in the data somewhere
$action = str_replace("'", "''", "action.php?id=$id&slot=$slot&service=$service&company=$company&user=$custname&department=$department&activity=$activity&item=$item&filebox=$filebox&date=$date&quantity=$quantity&type=$type&new=$new");

Open in new window

0
 
LVL 5

Expert Comment

by:UrbanTwitch
ID: 33424760
Does the 1 user have their javascript disabled? Also... post the full error message they get.
0
 
LVL 58

Expert Comment

by:cyberkiwi
ID: 33424768
Try again
$action = str_replace("'", "\\'", "action.php?id=$id&slot=$slot&service=$service&company=$company&user=$custname&department=$department&activity=$activity&item=$item&filebox=$filebox&date=$date&quantity=$quantity&type=$type&new=$new");

Open in new window

0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:peter_coop
ID: 33424944
cyber
still the same. i have pulled the response html from firebug and can only think that there is a space in the user field?
<a onclick="PopUp('action.php?id=4087&amp;slot=&amp;service=Standard&amp;company=8&amp;user=David 
Brown&amp;department=84&amp;activity=Box Retrival&amp;item=CEN11706&amp;filebox=Only used with files&amp;date=12-08-2010 13:12:53&amp;quantity=0&amp;type=0&amp;new=1','winAvail','status=no,scrollbars=no,resizable=no,width=465,height=450');" href="#">Action</a>

Open in new window

0
 
LVL 5

Accepted Solution

by:
UrbanTwitch earned 1000 total points
ID: 33425029
Right here:

date=12-08-2010 13:12:53&amp;

and also in filebox=Only used with files

Lastly there shouldn't be a return between Dan and Brown...
0
 

Author Closing Comment

by:peter_coop
ID: 33425105
thank you very much
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question