Solved

unterminated string literal

Posted on 2010-08-12
6
622 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
  • 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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

803 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