Hi everyone.
First of all, I think this is a javascript issue, but I don’t know if this is a php or html problem, so feel free to guide me through this.
I have a page that opens a secondary window using javascript, let’s say: secondary.php which is a select window.
In that secondary.php I declared the following function:
[CODE]function doPostBack (code,description){
opener.document.form1.txtCode.value=code;
opener.document.form1.txtDescription.value=description;
window.close(this);
}
To populate secondary.php I do the following for each record: (ommiting some lines of php code not necessary for this post)
[CODE]<?
echo “<a href=”javascript:doPostBack(‘$i[0]’,’$i[1]’)”>”;
?>
(where $i is the variable containing the records)
The problem is that there are descriptions containing double quotes, for instance:
code=F001
description=3.5″ floppy disk
Then, the href indicated above must be:
javascript:doPostBack(‘F001′,’3.5″ floppy disk’)
or
javascript:doPostBack(‘F001′,’3.5″ floppy disk’)
but ? the href appears like this:
javascript:doPostBack(‘F001’,’3.5
Note that the last single quote and the ending parenthesis disappeared, so, when I click that href nothing happens.
I’ve tried a lot for days using the php str_replace function
[CODE]str_replace(“””,”\””,$i[0])
but the same thing happens. Now, I’m stuck and that’s why I come here because my brain is destroyed and I don’t know how to go from here.
Did someone here had the same situation?
or
How can I do considering that I can’t change the descriptions on the database?
Can I post this question in php forum? Is it considered as spam?
I really appreciate your help
Thanks