Solved

unterminated string literal

Posted on 2010-08-12
6
619 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

947 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now