Removing backslash inside input box with the key double quote

I have the code below at http://form.kr/test/1temp/withoutHTMLspecial.php?key="

<?php

$inputKey=$_GET['key'];
$see='
<!DOCTYPE HTML> 
<html> 
<head>
<meta charset="utf-8"> 
<meta name="viewport" content="width=device-width, initial-scale=1.0">  
<title>withoutHTMLspecial</title> 
</head> 

<body>
<input type="text" value="' .$inputKey. '" style="font-size:50px"> 
</body> 
</html>';

echo $see;

instead of the key "(double quote) the page above displays backslash in the input box.

So I added htmlSpecialChar at http://form.kr/test/1temp/withHTMLspecial.php?key=" like the code below.

<?php

define('ENT_SUBSTITUTE', 8);
$inputKey=$_GET['key'];
$inputKey=htmlspecialchars($inputKey, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
$see='
<!DOCTYPE HTML> 

<html> 
<head>
<meta charset="utf-8"> 
<meta name="viewport" content="width=device-width, initial-scale=1.0">  
<title>withHTMLspeial</title> 
</head> 

<body>
<input type="text" value="' .$inputKey. '" style="font-size:50px"> 
</body> 
</html>';
echo $see

It shows "(double quote) but a backslash comes in front of the double quote in the input box.
I like to remove the backslash.

The code below at http://form.kr/test/1temp/replaceBackslash.php?key=" is one of my trials for removing the backslash.

<?php

define('ENT_SUBSTITUTE', 8);
$inputKey=$_GET['key'];
$inputKey=htmlspecialchars($inputKey, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
$inputKey=str_replace('\"', '"', $inputKey);
$see='
<!DOCTYPE HTML> 

<html> 
<head>
<meta charset="utf-8"> 
<meta name="viewport" content="width=device-width, initial-scale=1.0">  
<title>replaceBackslash</title> 
</head> 

<body>
<input type="text" value="' .$inputKey. '" style="font-size:50px"> 
</body> 
</html>';

echo $see;

But the trial above still shows the backslash inside the input box.
How can I remove the stupid backslash inside the input box when $_GET[‘key’] is "?

Wouldn’t you be better off using HEREDOC?

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.