Solved

unterminated string literal

Posted on 2010-08-12
6
624 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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 250 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Suggested Solutions

Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
The viewer will learn how to count occurrences of each item in an array.
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.

756 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