Forum Moderators: open
i have a button in my form which opens a new window. upon clicking the said button, it should pass the string $title to the new window thru url. however, the string accepts special characters. i believe that strings with special characters must be escaped first then unescape (to the new window) for it to be displayed properly.
here is a sample of the code: (php)
$title = $results["Title"];
<form name="modify" method="post">
<input type="text" name="Title" size="50" value=" <? echo $title;?> ">
<input type="button" name="pick" value="Send" onClick = "window.open('modtitle.php?OpenForm&title=<? echo $title?>&actione=load','new_win','width=400,height=300');">
</form>
the problem: where will i insert the function that will escape the string $title that will be passed thru url.
on the other hand, at my new child window, the string $title must be placed in a textarea.
<textarea name="Title" cols="51" rows="5"><? echo $title?></textarea>
the problem: how will i unescape the string $title to display it in the textarea in my new window.
please help....
Have you thought about trying it with php? Something like this might work
$title = $results["Title"];
$esctitle = addslashes [ca.php.net]($title);
<form name="modify" method="post">
<input type="text" name="Title" size="50" value=" <?= $title;?> ">
<input type="button" name="pick" value="Send" onClick = "window.open('modtitle.php?OpenForm&title=<? echo $esctitle?>&actione=load','new_win','width=400,height=300');">
</form>
<textarea name="Title" cols="51" rows="5"><?= stripslashes [ca.php.net]($title)?></textarea>
I slipped a little shorthand in there too, this
<? echo $title;?>
is the same as
<?= $title;?>
just a little tighter code for echoing vars. Give that a try and, if not, come back and we'll see what else we can dig up.
anyway, i found a solution to my problem... i need not have to use the escape and unescape function. i just have to use URLEncode($title) to view the special characters correctly in the new window. thank you so much.