in Education by
I have a $_GET[q] from the URL. I am trying to ECHO the search term back into the search box. Sometimes people might submit queries encapsulated in quotes and in these cases the ECHO interprets the search term ECHO $_GET[q]; as: ECHO ""search term""; and as a result I get a blank search box. Search queries with a single quote, like: Peter's house, work fine. When I use: mysqli_real_escape_string($conn, $_GET[q]) I only get a backslash in the search box. How could I populate the search box with a search term encapsulated in double quotes? JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
You could also use: echo str_replace('"','',$_GET[q]); This will of course remove all double quotes, so if they may be valid somewhere in the search term then better might be: echo str_replace('"','"',$_GET[q]); Haven't tested this but this might also work: echo html_entity_decode(htmlentities($_GET[q))

Related questions

0 votes
    I have a $_GET[q] from the URL. I am trying to ECHO the search term back into the search box. ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 4, 2022 in Education by JackTerrance
0 votes
    What is difference between including the header file with-in angular braces < > and double quotes “ “?...
asked Jan 17, 2021 in Technology by JackTerrance
0 votes
    What is difference between including the header file with-in angular braces < > and double quotes “ “?...
asked Jan 17, 2021 in Technology by JackTerrance
+1 vote
    What is difference between including the header file with-in angular braces < > and double quotes “ “?...
asked Nov 9, 2020 in Technology by JackTerrance
0 votes
    Recently I asked a question regarding preg_match_all with php, and i got the perfect solution as expected ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 11, 2022 in Education by JackTerrance
0 votes
    I am trying to deserialize a JSON string but I get an error: var response = jss.Deserialize(responseValue) ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 26, 2022 in Education by JackTerrance
0 votes
    I am trying to deserialize a json string received as a response from the service. The client is Windows ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 26, 2022 in Education by JackTerrance
0 votes
    Any data written in double quotes is a numeric constant true / false Select the correct answer from above options...
asked Dec 23, 2021 in Education by JackTerrance
+1 vote
    What is the behavioral difference when the header file is included in double-quotes (“”) and angular braces (<>)?...
asked Nov 8, 2020 in Technology by JackTerrance
0 votes
    I am trying to echo out an array using for each but it's not displaying any values. The only ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 26, 2022 in Education by JackTerrance
0 votes
    I am trying to echo out an array using for each but it's not displaying any values. The only ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 25, 2022 in Education by JackTerrance
0 votes
    What is the difference between “echo” and “print” in PHP?...
asked Jul 13, 2021 in Education by JackTerrance
0 votes
    I make a website on php and want to read some information from text file. the reason is if, i ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 8, 2022 in Education by JackTerrance
0 votes
    I make a website on php and want to read some information from text file. the reason is if, i ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 8, 2022 in Education by JackTerrance
0 votes
    I have an old custom built content management system in PHP, where users can write articles. When the body ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 13, 2022 in Education by JackTerrance
...